typo
[silc.git] / lib / silccore / silcmemory.c
1 /*
2
3   silcmemory.c
4
5   Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
6
7   Copyright (C) 1999 - 2000 Pekka Riikonen
8
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; either version 2 of the License, or
12   (at your option) any later version.
13   
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19 */
20 /*
21  * $Id$
22  * $Log$
23  * Revision 1.2  2000/07/05 06:05:56  priikone
24  *      Assert if system is out of memory.
25  *
26  * Revision 1.1.1.1  2000/06/27 11:36:55  priikone
27  *      Imported from internal CVS/Added Log headers.
28  *
29  *
30  */
31
32 #include "silcincludes.h"
33
34 void *silc_malloc(size_t size)
35 {
36   void *addr;
37 #ifdef HAVE_MLOCK
38   addr = malloc(size);
39   assert(addr != NULL);
40   mlock(addr, size);
41   return addr;
42 #else
43   addr = malloc(size);
44   assert(addr != NULL);
45   return addr;
46 #endif
47 }
48
49 void *silc_calloc(size_t items, size_t size)
50 {
51   void *addr;
52 #ifdef HAVE_MLOCK
53   addr = calloc(items, size);
54   assert(addr != NULL);
55   mlock(addr, size);
56   return addr;
57 #else
58   addr = calloc(items, size);
59   assert(addr != NULL);
60   return addr;
61 #endif
62 }
63
64 void *silc_realloc(void *ptr, size_t size)
65 {
66   void *addr;
67 #ifdef HAVE_MLOCK
68   addr = realloc(ptr, size);
69   assert(addr != NULL);
70   mlock(addr, size);
71   return addr;
72 #else
73   addr = realloc(ptr, size);
74   assert(addr != NULL);
75   return addr;
76 #endif
77 }
78
79 void silc_free(void *ptr)
80 {
81   free(ptr);
82 }
83
84
85
86
87
88
89