libdebian-installer
mem.h
1/*
2 * mem.h
3 *
4 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
5 * 2003 Bastian Blank <waldi@debian.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef DEBIAN_INSTALLER__MEM_H
22#define DEBIAN_INSTALLER__MEM_H
23
24#include <debian-installer/types.h>
25
26#include <stdio.h>
27
41void *di_malloc (size_t n_bytes) __attribute__ ((malloc));
42
50void *di_malloc0 (size_t n_bytes) __attribute__ ((malloc));
51
60void *di_realloc (void *mem, size_t n_bytes) __attribute__ ((malloc));
61
67void di_free (void *mem);
68
73#define di_new(struct_type, n_structs) \
74 ((struct_type *) di_malloc (sizeof (struct_type) * (n_structs)))
79#define di_new0(struct_type, n_structs) \
80 ((struct_type *) di_malloc0 (sizeof (struct_type) * (n_structs)))
86#define di_renew(struct_type, mem, n_structs) \
87 ((struct_type *) di_realloc ((mem), sizeof (struct_type) * (n_structs)))
88
90#endif
void di_free(void *mem)
Definition mem.c:60
void * di_malloc0(size_t n_bytes) __attribute__((malloc))
Definition mem.c:40
void * di_malloc(size_t n_bytes) __attribute__((malloc))
Definition mem.c:29
void * di_realloc(void *mem, size_t n_bytes) __attribute__((malloc))
Definition mem.c:51