master
c 87 lines 2.6 KB
Raw
1 // Copyright (C) 2000 - 2002 Hewlett-Packard Company
2 //
3 // This program is free software; you can redistribute it and/or modify it
4 // under the term of the GNU Lesser General Public License as published by the
5 // Free Software Foundation; either version 2 of the License, or (at your
6 // option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful, but WITHOUT
9 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11 // for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with this program; if not, write to the Free Software Foundation,
15 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // _________________
17
18 // @(#) $Revision: 4.33 $ $Source: /judy/src/JudyCommon/JudyMalloc.c $
19 // ************************************************************************ //
20 // JUDY - Memory Allocater //
21 // -by- //
22 // Douglas L. Baskins //
23 // Hewlett Packard //
24 // Fort Collins, Co //
25 // (970) 229-2027 //
26 // //
27 // ************************************************************************ //
28
29 // JUDY INCLUDE FILES
30 #include "Judy.h"
31
32 // ****************************************************************************
33 // J U D Y M A L L O C
34 //
35 // Allocate RAM. This is the single location in Judy code that calls
36 // malloc(3C). Note: JPM accounting occurs at a higher level.
37
38 Word_t JudyMalloc(
39 Word_t Words)
40 {
41 Word_t Addr;
42
43 Addr = (Word_t) malloc(Words * sizeof(Word_t));
44 return(Addr);
45
46 } // JudyMalloc()
47
48
49 // ****************************************************************************
50 // J U D Y F R E E
51
52 void JudyFree(
53 void * PWord,
54 Word_t Words)
55 {
56 (void) Words;
57 free(PWord);
58
59 } // JudyFree()
60
61
62 // ****************************************************************************
63 // J U D Y M A L L O C
64 //
65 // Higher-level "wrapper" for allocating objects that need not be in RAM,
66 // although at this time they are in fact only in RAM. Later we hope that some
67 // entire subtrees (at a JPM or branch) can be "virtual", so their allocations
68 // and frees should go through this level.
69
70 Word_t JudyMallocVirtual(
71 Word_t Words)
72 {
73 return(JudyMalloc(Words));
74
75 } // JudyMallocVirtual()
76
77
78 // ****************************************************************************
79 // J U D Y F R E E
80
81 void JudyFreeVirtual(
82 void * PWord,
83 Word_t Words)
84 {
85 JudyFree(PWord, Words);
86
87 } // JudyFreeVirtual()