2024-01-23 18:29:33 +01:00
/*
This is part of WHY2
Copyright ( C ) 2022 Václav Š mejkal
This program is free software : you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation , either version 3 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program . If not , see < https : //www.gnu.org/licenses/>.
*/
2023-01-29 20:19:29 +01:00
# ifndef WHY2_MEMORY_H
# define WHY2_MEMORY_H
2024-01-23 18:27:24 +01:00
# ifdef __cplusplus
extern " C " {
# endif
2024-04-20 11:22:09 +02:00
# include <why2/flags.h>
2023-01-29 20:25:32 +01:00
void * why2_malloc ( unsigned long size ) ;
2023-01-29 20:33:51 +01:00
void * why2_calloc ( unsigned long element , unsigned long size ) ;
2023-01-31 15:51:02 +01:00
void * why2_realloc ( void * pointer , unsigned long size ) ;
2023-02-01 15:07:07 +01:00
char * why2_strdup ( char * string ) ;
2023-02-05 18:23:03 +01:00
void * why2_fopen ( char * name , char * modes ) ;
void * why2_fdopen ( int file , char * modes ) ;
void * why2_opendir ( char * name ) ;
2023-02-05 18:25:42 +01:00
void why2_deallocate ( void * pointer ) ;
2023-01-29 20:19:29 +01:00
2023-02-03 16:37:00 +01:00
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
2023-02-02 16:40:24 +01:00
2024-04-20 11:22:09 +02:00
why2_bool why2_allocated ( void * pointer ) ; //CHECKS IF pointer WAS ALLOCATED USING WHY2-MEM
2024-01-23 18:27:24 +01:00
# ifdef __cplusplus
}
# endif
2023-01-29 20:19:29 +01:00
# endif