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