5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 1999 - 2002 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
21 #include "silcincludes.h"
23 #ifndef SILC_STACKTRACE
25 #define SILC_MAX_ALLOC (1024 * 1024L * 1024L)
27 void *silc_malloc(size_t size)
30 assert(size >= 0 && size <= SILC_MAX_ALLOC);
36 void *silc_calloc(size_t items, size_t size)
39 assert(size * items >= 0 && size * items <= SILC_MAX_ALLOC);
40 addr = calloc(items, size);
45 void *silc_realloc(void *ptr, size_t size)
48 assert(size >= 0 && size <= SILC_MAX_ALLOC);
49 addr = realloc(ptr, size);
54 void silc_free(void *ptr)
59 void *silc_memdup(const void *ptr, size_t size)
62 addr = silc_malloc(size + 1);
64 memcpy((void *)addr, ptr, size);
69 #endif /* !SILC_STACKTRACE */