forked from projectM-visualizer/projectm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwipemalloc.h
executable file
·64 lines (59 loc) · 1.89 KB
/
wipemalloc.h
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
59
60
61
62
63
64
/**
* projectM -- Milkdrop-esque visualisation SDK
* Copyright (C)2003-2007 projectM Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* See 'LICENSE.txt' included within this release
*
*/
/**
* $Id: wipemalloc.h,v 1.1.1.1 2005/12/23 18:05:03 psperl Exp $
*
* Contains an inline function which can replace malloc() that also
* call memset( ..., 0, sizeof( ... ) ) on the allocated block for
* safe initialization
*
* $Log$
*/
#ifndef _WIPEMALLOC_H
#define _WIPEMALLOC_H
#ifndef MACOS
#ifndef HAVE_AIX /** AIX has malloc() defined in a strange place... */
#ifdef WIN32
#include <malloc.h>
#endif
#include <string.h>
#include <stdlib.h>
#else
#include <stdlib.h>
#endif /** !HAVE_AIX */
#else
#include <string.h>
#include <stdlib.h>
#endif /** !MACOS */
#include <stdio.h>
#ifdef PANTS
#if defined(WIN32) && !defined(inline)
#define inline
#endif
#endif
/** Safe memory allocator */
void *wipemalloc( size_t count );
void wipefree( void *ptr );
/** wipe_aligned_malloc() must be matched with aligned_free() */
void *wipe_aligned_alloc( size_t align, size_t count);
inline void *wipe_aligned_alloc( size_t count ) { return wipe_aligned_alloc(16,count); }
void wipe_aligned_free( void *ptr );
#endif /** !_WIPEMALLOC_H */