]> git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/stub_mem.cc
Renamed squid.h to squid-old.h and config.h to squid.h
[thirdparty/squid.git] / src / tests / stub_mem.cc
1 /*
2 * stub file for mem.cc
3 */
4
5 #include "squid.h"
6
7 #define STUB_API "stub_mem.cc"
8 #include "STUB.h"
9 /* mem* definitions are still in protos.h */
10 #include "protos.h"
11
12 extern "C" void
13 memFreeString(size_t size, void *buf)
14 {
15 xfree(buf);
16 }
17
18 extern "C" void *
19 memAllocString(size_t net_size, size_t * gross_size)
20 {
21 *gross_size=net_size;
22 return xmalloc(net_size);
23 }
24
25 extern "C" void
26 memFreeBuf(size_t size, void *buf)
27 {
28 xfree(buf);
29 }
30
31 extern "C" void *
32 memAllocBuf(size_t net_size, size_t * gross_size)
33 {
34 *gross_size=net_size;
35 return xcalloc(1, net_size);
36 }
37
38 /* net_size is the new size, *gross size is the old gross size, to be changed to
39 * the new gross size as a side-effect.
40 */
41 extern "C" void *
42 memReallocBuf(void *oldbuf, size_t net_size, size_t * gross_size)
43 {
44 void *rv=xrealloc(oldbuf,net_size);
45 // if (net_size > *gross_size)
46 // memset(rv+net_size,0,net_size-*gross_size);
47 *gross_size=net_size;
48 return rv;
49 }
50
51 static void
52 cxx_xfree(void * ptr)
53 {
54 xfree(ptr);
55 }
56
57 FREE *
58 memFreeBufFunc(size_t size)
59 {
60 return cxx_xfree;
61 }
62
63 void *
64 memAllocate(mem_type type)
65 STUB_RETVAL(NULL)
66
67 void
68 memFree(void *p, int type)
69 STUB