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 2 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, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
26 #include "keybox-defs.h"
29 static void *(*alloc_func
)(size_t n
) = malloc
;
30 static void *(*realloc_func
)(void *p
, size_t n
) = realloc
;
31 static void (*free_func
)(void*) = free
;
36 keybox_set_malloc_hooks ( void *(*new_alloc_func
)(size_t n
),
37 void *(*new_realloc_func
)(void *p
, size_t n
),
38 void (*new_free_func
)(void*) )
40 alloc_func
= new_alloc_func
;
41 realloc_func
= new_realloc_func
;
42 free_func
= new_free_func
;
46 _keybox_malloc (size_t n
)
48 return alloc_func (n
);
52 _keybox_realloc (void *a
, size_t n
)
54 return realloc_func (a
, n
);
58 _keybox_calloc (size_t n
, size_t m
)
60 void *p
= _keybox_malloc (n
*m
);
67 _keybox_free (void *p
)