1 | /* |
---|
2 | * Copyright (C) 1996-2015 The Squid Software Foundation and contributors |
---|
3 | * |
---|
4 | * Squid software is distributed under GPLv2+ license and includes |
---|
5 | * contributions from numerous individuals and organizations. |
---|
6 | * Please see the COPYING and CONTRIBUTORS files for details. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * stub file for mem.cc |
---|
11 | */ |
---|
12 | |
---|
13 | #include "squid.h" |
---|
14 | |
---|
15 | #define STUB_API "stub_mem.cc" |
---|
16 | #include "Mem.h" |
---|
17 | #include "STUB.h" |
---|
18 | |
---|
19 | void |
---|
20 | memFreeString(size_t size, void *buf) |
---|
21 | { |
---|
22 | xfree(buf); |
---|
23 | } |
---|
24 | |
---|
25 | void * |
---|
26 | memAllocString(size_t net_size, size_t * gross_size) |
---|
27 | { |
---|
28 | *gross_size=net_size; |
---|
29 | return xmalloc(net_size); |
---|
30 | } |
---|
31 | |
---|
32 | void |
---|
33 | memFreeBuf(size_t size, void *buf) |
---|
34 | { |
---|
35 | xfree(buf); |
---|
36 | } |
---|
37 | |
---|
38 | void * |
---|
39 | memAllocBuf(size_t net_size, size_t * gross_size) |
---|
40 | { |
---|
41 | *gross_size=net_size; |
---|
42 | return xcalloc(1, net_size); |
---|
43 | } |
---|
44 | |
---|
45 | /* net_size is the new size, *gross size is the old gross size, to be changed to |
---|
46 | * the new gross size as a side-effect. |
---|
47 | */ |
---|
48 | void * |
---|
49 | memReallocBuf(void *oldbuf, size_t net_size, size_t * gross_size) |
---|
50 | { |
---|
51 | void *rv=xrealloc(oldbuf,net_size); |
---|
52 | // if (net_size > *gross_size) |
---|
53 | // memset(rv+net_size,0,net_size-*gross_size); |
---|
54 | *gross_size=net_size; |
---|
55 | return rv; |
---|
56 | } |
---|
57 | |
---|
58 | static void |
---|
59 | cxx_xfree(void * ptr) |
---|
60 | { |
---|
61 | xfree(ptr); |
---|
62 | } |
---|
63 | |
---|
64 | FREE * |
---|
65 | memFreeBufFunc(size_t size) |
---|
66 | { |
---|
67 | return cxx_xfree; |
---|
68 | } |
---|
69 | |
---|
70 | void * memAllocate(mem_type type) |
---|
71 | { |
---|
72 | // let's waste plenty of memory. This should cover any possible need |
---|
73 | return xmalloc(64*1024); |
---|
74 | } |
---|
75 | void memFree(void *p, int type) |
---|
76 | { |
---|
77 | xfree(p); |
---|
78 | } |
---|
79 | void Mem::Init(void) STUB_NOP |
---|
80 | void memDataInit(mem_type, const char *, size_t, int, bool) STUB_NOP |
---|
81 | int memInUse(mem_type) STUB_RETVAL(0) |
---|
82 | void memConfigure(void) STUB_NOP |
---|
83 | |
---|