/[LeafOK_CVS]/pvpgn-1.7.4/src/common/xalloc.h
ViewVC logotype

Contents of /pvpgn-1.7.4/src/common/xalloc.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Tue Jun 6 03:41:38 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-chdr
no message

1 /*
2 * Copyright (C) 2004 Dizzy (dizzy@roedu.net)
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 #ifndef INCLUDED_XALLOC_TYPES
20
21 /* out of memory callback function */
22 typedef int (*t_oom_cb)(void);
23
24 #define INCLUDED_XALLOC_TYPES
25
26 #endif /* INCLUDED_XALLOC_TYPES */
27
28 #ifndef INCLUDED_XALLOC_PROTOS
29 #define INCLUDED_XALLOC_PROTOS
30
31 #ifdef HAVE_STDDEF_H
32 # include <stddef.h>
33 #endif
34 #ifdef STDC_HEADERS
35 # include <stdlib.h>
36 #else
37 # ifdef HAVE_MALLOC_H
38 # include <malloc.h>
39 # endif
40 #endif
41
42 #ifndef XALLOC_SKIP
43
44 #define xmalloc(size) xmalloc_real(size,__FILE__,__LINE__)
45 void *xmalloc_real(size_t size, const char *fn, unsigned ln);
46 #define xcalloc(no,size) xcalloc_real(no,size,__FILE__,__LINE__)
47 void *xcalloc_real(size_t nmemb, size_t size, const char *fn, unsigned ln);
48 #define xrealloc(ptr,size) xrealloc_real(ptr,size,__FILE__,__LINE__)
49 void *xrealloc_real(void *ptr, size_t size, const char *fn, unsigned ln);
50 #define xstrdup(str) xstrdup_real(str,__FILE__,__LINE__)
51 char *xstrdup_real(const char *str, const char *fn, unsigned ln);
52 #define xfree(ptr) xfree_real(ptr,__FILE__,__LINE__)
53 void xfree_real(void *ptr, const char *fn, unsigned ln);
54 void xalloc_setcb(t_oom_cb cb);
55
56 #else /* XALLOC_SKIP */
57
58 #define xmalloc(size) malloc(size)
59 #define xcalloc(no,size) calloc(no,size)
60 #define xrealloc(ptr,size) realloc(ptr,size)
61 #define xstrdup(str) strdup(str)
62 #define xfree(ptr) free(ptr)
63 #define xalloc_setcb(cb)
64
65 #endif
66
67 #endif /* INCLUDED_XALLOC_PROTOS */

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1