created why2_allocated fn
checks for why2-mem allocation
This commit is contained in:
parent
19ccc45e0a
commit
65135ac961
@ -23,6 +23,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <why2/flags.h>
|
||||
|
||||
void *why2_malloc(unsigned long size);
|
||||
void *why2_calloc(unsigned long element, unsigned long size);
|
||||
void *why2_realloc(void *pointer, unsigned long size);
|
||||
@ -37,6 +39,8 @@ void why2_deallocate(void *pointer);
|
||||
|
||||
void why2_clean_memory(char *identifier); //identifier SPECIFIES WHICH NODES TO DEALLOCATE | THIS IS BASICALLY GARBAGE COLLECTOR | PASS why2_get_default_memory_identifier() FOR DEALLOCATING EVERYTHING
|
||||
|
||||
why2_bool why2_allocated(void *pointer); //CHECKS IF pointer WAS ALLOCATED USING WHY2-MEM
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -241,3 +241,8 @@ void why2_clean_memory(char *identifier)
|
||||
|
||||
why2_reset_memory_identifier(); //THIS WILL CAUSE SEGFAULT IF YOU DIDN'T USE why2_set_memory_identifier
|
||||
}
|
||||
|
||||
why2_bool why2_allocated(void *pointer)
|
||||
{
|
||||
return get_node(pointer) != NULL;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user