1 /* keybox-util.c - Utility functions for Keybox
2 * Copyright (C) 2001 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * GnuPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
25 #include "keybox-defs.h"
28 static void *(*alloc_func
)(size_t n
) = malloc
;
29 static void *(*realloc_func
)(void *p
, size_t n
) = realloc
;
30 static void (*free_func
)(void*) = free
;
35 keybox_set_malloc_hooks ( void *(*new_alloc_func
)(size_t n
),
36 void *(*new_realloc_func
)(void *p
, size_t n
),
37 void (*new_free_func
)(void*) )
39 alloc_func
= new_alloc_func
;
40 realloc_func
= new_realloc_func
;
41 free_func
= new_free_func
;
45 _keybox_malloc (size_t n
)
47 return alloc_func (n
);
51 _keybox_realloc (void *a
, size_t n
)
53 return realloc_func (a
, n
);
57 _keybox_calloc (size_t n
, size_t m
)
59 void *p
= _keybox_malloc (n
*m
);
66 _keybox_free (void *p
)