00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#ifndef DEBIAN_INSTALLER__MEM_H
00025
#define DEBIAN_INSTALLER__MEM_H
00026
00027
#include <debian-installer/types.h>
00028
00029
#include <stdio.h>
00030
00044
void *
di_malloc (size_t n_bytes) __attribute__ ((malloc));
00045
00053
void *
di_malloc0 (size_t n_bytes) __attribute__ ((malloc));
00054
00063
void *
di_realloc (
void *mem, size_t n_bytes) __attribute__ ((malloc));
00064
00070
void di_free (
void *mem);
00071
00076 #define di_new(struct_type, n_structs) \
00077
((struct_type *) di_malloc (sizeof (struct_type) * (n_structs)))
00078
00082 #define di_new0(struct_type, n_structs) \
00083
((struct_type *) di_malloc0 (sizeof (struct_type) * (n_structs)))
00084
00089 #define di_renew(struct_type, mem, n_structs) \
00090
((struct_type *) di_realloc ((mem), sizeof (struct_type) * (n_structs)))
00091
00093
#endif