source: squid-ssl/trunk/fuentes/tools/stub_mem.cc @ 5495

Last change on this file since 5495 was 5495, checked in by Juanma, 21 months ago

Initial release

File size: 1.6 KB
Line 
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 "tests/STUB.h"
18
19void
20memFreeString(size_t size, void *buf)
21{
22    xfree(buf);
23}
24
25void *
26memAllocString(size_t net_size, size_t * gross_size)
27{
28    *gross_size=net_size;
29    return xmalloc(net_size);
30}
31
32void
33memFreeBuf(size_t size, void *buf)
34{
35    xfree(buf);
36}
37
38void *
39memAllocBuf(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 */
48void *
49memReallocBuf(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
58static void
59cxx_xfree(void * ptr)
60{
61    xfree(ptr);
62}
63
64FREE *
65memFreeBufFunc(size_t size)
66{
67    return cxx_xfree;
68}
69
70void * memAllocate(mem_type type)
71{
72    // let's waste plenty of memory. This should cover any possible need
73    return xmalloc(64*1024);
74}
75void memFree(void *p, int type)
76{
77    xfree(p);
78}
79void Mem::Init(void) STUB_NOP
80void memDataInit(mem_type, const char *, size_t, int, bool) STUB_NOP
81int memInUse(mem_type) STUB_RETVAL(0)
82void memConfigure(void) STUB_NOP
83
Note: See TracBrowser for help on using the repository browser.