Yet Another eXchange Tool  DO_NOT_EDIT_HERE
ppm_xfuncs.h
Go to the documentation of this file.
1 
10 /*
11  * Keywords: fail-safe wrappers
12  * Maintainer: Thomas Jahns <jahns@dkrz.de>
13  * URL: https://www.dkrz.de/redmine/projects/show/scales-ppm
14  *
15  * Redistribution and use in source and binary forms, with or without
16  * modification, are permitted provided that the following conditions are
17  * met:
18  *
19  * Redistributions of source code must retain the above copyright notice,
20  * this list of conditions and the following disclaimer.
21  *
22  * Redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution.
25  *
26  * Neither the name of the DKRZ GmbH nor the names of its contributors
27  * may be used to endorse or promote products derived from this software
28  * without specific prior written permission.
29  *
30  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
31  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
32  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
33  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
34  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  */
42 
43 #ifndef PPM_XFUNCS_INCLUDED
44 #define PPM_XFUNCS_INCLUDED
45 
46 #ifdef HAVE_CONFIG_H
47 #include <config.h>
48 #endif
49 
50 #include <stdio.h>
51 #include <stdlib.h>
52 
53 #include "core/symprefix.h"
54 
55 void *
56 SymPrefix(xcalloc)(size_t nmemb, size_t size, const char *source, int line);
57 
58 void *
59 SymPrefix(xmalloc)(size_t size, const char *source, int line);
60 
61 void *
62 SymPrefix(xrealloc)(void *ptr, size_t size, const char *source, int line);
63 
64 #define xcalloc(nmemb,size) \
65  SymPrefix(xcalloc)((nmemb), (size), __FILE__, __LINE__)
66 #define xmalloc(size) SymPrefix(xmalloc)((size), __FILE__, __LINE__)
67 #define xrealloc(ptr,size) \
68  SymPrefix(xrealloc)((ptr), (size), __FILE__, __LINE__)
69 
70 FILE *
71 SymPrefix(xfopen)(const char *path, const char *mode,
72  const char *source, int line);
73 
74 #define xfopen(path, mode) SymPrefix(xfopen)(path, mode, __FILE__, __LINE__)
75 
76 void
77 SymPrefix(xfclose)(FILE *fp, const char *source, int line);
78 
79 #define xfclose(fp) SymPrefix(xfclose)(fp, __FILE__, __LINE__)
80 
81 int
82 SymPrefix(xfputc)(int c, FILE *stream, const char *source, int line);
83 
84 #define xfputc(c,stream) SymPrefix(xfputc)((c),(stream), __FILE__, __LINE__)
85 
86 #endif
87 /*
88  * Local Variables:
89  * license-project-url: "https://www.dkrz.de/redmine/projects/show/scales-ppm"
90  * license-markup: "doxygen"
91  * license-default: "bsd"
92  * End:
93  */
#define xfclose(fp)
Definition: ppm_xfuncs.h:79
Define library-specific symbol prefix macros.
#define xrealloc(ptr, size)
Definition: ppm_xfuncs.h:67
#define xcalloc(nmemb, size)
Definition: ppm_xfuncs.h:64
#define SymPrefix(symbol)
Definition: symprefix.h:53
#define xfopen(path, mode)
Definition: ppm_xfuncs.h:74
#define xfputc(c, stream)
Definition: ppm_xfuncs.h:84
#define xmalloc(size)
Definition: ppm_xfuncs.h:66