source: branches/samhain_3_1/include/sh_mem.h@ 503

Last change on this file since 503 was 383, checked in by katerina, 13 years ago

Fix for ticket #281 (warnings from clang static analyzer).

File size: 2.4 KB
Line 
1/* SAMHAIN file system integrity testing */
2/* Copyright (C) 1999 Rainer Wichmann */
3/* */
4/* This program is free software; you can redistribute it */
5/* and/or modify */
6/* it under the terms of the GNU General Public License as */
7/* published by */
8/* the Free Software Foundation; either version 2 of the License, or */
9/* (at your option) any later version. */
10/* */
11/* This program is distributed in the hope that it will be useful, */
12/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
13/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
14/* GNU General Public License for more details. */
15/* */
16/* You should have received a copy of the GNU General Public License */
17/* along with this program; if not, write to the Free Software */
18/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20
21#ifndef SH_MEM_H
22#define SH_MEM_H
23
24
25#ifdef MEM_DEBUG
26
27void sh_mem_openf (char * file, int fd);
28void sh_mem_closef (int fd);
29void sh_mem_check (void);
30void sh_mem_dump (void);
31void sh_mem_free (void * a, char * file, int line);
32void * sh_mem_malloc (size_t size, char * file, int line);
33void sh_mem_stat (void);
34
35#define SH_FREE(a) sh_mem_free((a), FIL__, __LINE__)
36#define SH_ALLOC(a) sh_mem_malloc((a), FIL__, __LINE__)
37#define SH_OALLOC(a,b,c) sh_mem_malloc((a), (b), (c))
38
39#else
40
41#if defined(__GNUC__) && (__GNUC__ >= 3)
42#undef SH_GNUC_MALLOC
43#define SH_GNUC_MALLOC __attribute__((malloc))
44#else
45#undef SH_GNUC_MALLOC
46#define SH_GNUC_MALLOC
47#endif
48
49void sh_mem_free (/*@only@*//*@out@*//*@null@*/ void * a);
50/*@only@*//*@notnull@*/void * sh_mem_malloc (size_t size) SH_GNUC_MALLOC;
51
52#define SH_FREE(a) sh_mem_free(a)
53#define SH_ALLOC(a) sh_mem_malloc(a)
54#define SH_OALLOC(a,b,c) ((void) (b), \
55 (void) (c), \
56 sh_mem_malloc(a)) \
57
58#endif
59
60/* #ifndef SH_MEM_H */
61#endif
Note: See TracBrowser for help on using the repository browser.