xalloc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_COMPAT_XALLOC_H
10 #define SQUID_COMPAT_XALLOC_H
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
23 void *xcalloc(size_t n, size_t sz);
24 
32 void *xmalloc(size_t sz);
33 
38 void *xrealloc(void *s, size_t sz);
39 
47 void free_const(const void *s);
48 
60 static inline void xfree(const void *p) { if (p) free_const(p); }
61 
73 #define safe_free(x) while ((x)) { free_const((x)); (x) = nullptr; }
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #if XMALLOC_STATISTICS
80 extern void malloc_statistics(void (*func) (int, int, int, void *), void *data);
81 #endif
82 
83 #endif /* SQUID_COMPAT_XALLOC_H */
84 
static void xfree(const void *p)
Definition: xalloc.h:60
void * xmalloc(size_t sz)
Definition: xalloc.cc:100
void * xrealloc(void *s, size_t sz)
Definition: xalloc.cc:126
void * xcalloc(size_t n, size_t sz)
Definition: xalloc.cc:71
void free_const(const void *s)
Definition: xalloc.cc:153

 

Introduction

Documentation

Support

Miscellaneous