mem.h

00001 /*
00002  * mem.h
00003  *
00004  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
00005  *               2003 Bastian Blank <waldi@debian.org>
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  * $Id: mem.h 29603 2005-07-31 16:10:46Z cjwatson $
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

Generated on Sat Sep 29 08:45:16 2007 for libdebian-installer by  doxygen 1.5.1