• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List

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, see <http://www.gnu.org/licenses/>.
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

Generated on Sat Feb 16 2013 17:59:45 for libdebian-installer by  doxygen 1.7.1