00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef DEBIAN_INSTALLER__MEM_H
00022 #define DEBIAN_INSTALLER__MEM_H
00023
00024 #include <debian-installer/types.h>
00025
00026 #include <stdio.h>
00027
00041 void *di_malloc (size_t n_bytes) __attribute__ ((malloc));
00042
00050 void *di_malloc0 (size_t n_bytes) __attribute__ ((malloc));
00051
00060 void *di_realloc (void *mem, size_t n_bytes) __attribute__ ((malloc));
00061
00067 void di_free (void *mem);
00068
00073 #define di_new(struct_type, n_structs) \
00074 ((struct_type *) di_malloc (sizeof (struct_type) * (n_structs)))
00075
00079 #define di_new0(struct_type, n_structs) \
00080 ((struct_type *) di_malloc0 (sizeof (struct_type) * (n_structs)))
00081
00086 #define di_renew(struct_type, mem, n_structs) \
00087 ((struct_type *) di_realloc ((mem), sizeof (struct_type) * (n_structs)))
00088
00090 #endif