xalloc.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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
13extern "C" {
14#endif
15
23void *xcalloc(size_t n, size_t sz);
24
32void *xmalloc(size_t sz);
33
38void *xrealloc(void *s, size_t sz);
39
47void free_const(const void *s);
48
60static 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
80extern void malloc_statistics(void (*func) (int, int, int, void *), void *data);
81#endif
82
83#endif /* _SQUID_COMPAT_XALLOC_H */
84
void const char int sz
Definition: stub_cbdata.cc:16
void free_const(const void *s)
Definition: xalloc.cc:153
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
static void xfree(const void *p)
Definition: xalloc.h:60

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors