File: mpool.h

package info (click to toggle)
clamav 0.98.7+dfsg-0+deb6u2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 60,204 kB
  • ctags: 49,129
  • sloc: cpp: 267,090; ansic: 152,211; sh: 35,196; python: 2,630; makefile: 2,220; perl: 1,690; pascal: 1,218; lisp: 184; csh: 117; xml: 38; asm: 32; exp: 4
file content (58 lines) | stat: -rw-r--r-- 2,181 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 *  Copyright (C) 2008 Sourcefire, Inc.
 *
 *  Authors: aCaB <acab@clamav.net>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *  MA 02110-1301, USA.
 */

#ifndef MPOOL_H
#define MPOOL_H

#ifdef USE_MPOOL
#include "cltypes.h"
typedef struct MP mpool_t;
struct cl_engine;

mpool_t *mpool_create(void);
void mpool_destroy(mpool_t *mpool);
void *mpool_malloc(mpool_t *mpool, size_t size);
void mpool_free(mpool_t *mpool, void *ptr);
void *mpool_calloc(mpool_t *mpool, size_t nmemb, size_t size);
void *mpool_realloc(mpool_t *mpool, void *ptr, size_t size);
void *mpool_realloc2(mpool_t *mpool, void *ptr, size_t size);
unsigned char *cli_mpool_hex2str(mpool_t* mpool, const char *src);
char *cli_mpool_strdup(mpool_t *mpool, const char *s);
char *cli_mpool_virname(mpool_t *mpool, const char *virname, unsigned int official);
uint16_t *cli_mpool_hex2ui(mpool_t *mpool, const char *hex);
void mpool_flush(mpool_t *mpool);
int mpool_getstats(const struct cl_engine *engine, size_t *used, size_t *total);
#else /* USE_MPOOL */

typedef void mpool_t;
#define mpool_malloc(a, b) cli_malloc(b)
#define mpool_free(a, b) free(b)
#define mpool_calloc(a, b, c) cli_calloc(b, c)
#define mpool_realloc(a, b, c) cli_realloc(b, c)
#define mpool_realloc2(a, b, c) cli_realloc2(b, c)
#define cli_mpool_hex2str(mpool, src) cli_hex2str(src)
#define cli_mpool_strdup(mpool, s) cli_strdup(s)
#define cli_mpool_virname(mpool, a, b) cli_virname(a, b)
#define cli_mpool_hex2ui(mpool, hex) cli_hex2ui(hex)
#define mpool_flush(val)
#define mpool_getstats(mpool,used,total) -1
#endif /* USE_MPOOL */

#endif