Blame libevent/mm-internal.h

Packit e9ba0d
/*
Packit e9ba0d
 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
Packit e9ba0d
 *
Packit e9ba0d
 * Redistribution and use in source and binary forms, with or without
Packit e9ba0d
 * modification, are permitted provided that the following conditions
Packit e9ba0d
 * are met:
Packit e9ba0d
 * 1. Redistributions of source code must retain the above copyright
Packit e9ba0d
 *    notice, this list of conditions and the following disclaimer.
Packit e9ba0d
 * 2. Redistributions in binary form must reproduce the above copyright
Packit e9ba0d
 *    notice, this list of conditions and the following disclaimer in the
Packit e9ba0d
 *    documentation and/or other materials provided with the distribution.
Packit e9ba0d
 * 3. The name of the author may not be used to endorse or promote products
Packit e9ba0d
 *    derived from this software without specific prior written permission.
Packit e9ba0d
 *
Packit e9ba0d
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
Packit e9ba0d
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Packit e9ba0d
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Packit e9ba0d
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
Packit e9ba0d
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
Packit e9ba0d
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Packit e9ba0d
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Packit e9ba0d
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Packit e9ba0d
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
Packit e9ba0d
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Packit e9ba0d
 */
Packit e9ba0d
#ifndef _EVENT_MM_INTERNAL_H
Packit e9ba0d
#define _EVENT_MM_INTERNAL_H
Packit e9ba0d
Packit e9ba0d
#include <sys/types.h>
Packit e9ba0d
Packit e9ba0d
#ifdef __cplusplus
Packit e9ba0d
extern "C" {
Packit e9ba0d
#endif
Packit e9ba0d
Packit e9ba0d
#ifndef _EVENT_DISABLE_MM_REPLACEMENT
Packit e9ba0d
/* Internal use only: Memory allocation functions. We give them nice short
Packit e9ba0d
 * mm_names for our own use, but make sure that the symbols have longer names
Packit e9ba0d
 * so they don't conflict with other libraries (like, say, libmm). */
Packit e9ba0d
void *event_mm_malloc_(size_t sz);
Packit e9ba0d
void *event_mm_calloc_(size_t count, size_t size);
Packit e9ba0d
char *event_mm_strdup_(const char *s);
Packit e9ba0d
void *event_mm_realloc_(void *p, size_t sz);
Packit e9ba0d
void event_mm_free_(void *p);
Packit e9ba0d
#define mm_malloc(sz) event_mm_malloc_(sz)
Packit e9ba0d
#define mm_calloc(count, size) event_mm_calloc_((count), (size))
Packit e9ba0d
#define mm_strdup(s) event_mm_strdup_(s)
Packit e9ba0d
#define mm_realloc(p, sz) event_mm_realloc_((p), (sz))
Packit e9ba0d
#define mm_free(p) event_mm_free_(p)
Packit e9ba0d
#else
Packit e9ba0d
#define mm_malloc(sz) malloc(sz)
Packit e9ba0d
#define mm_calloc(n, sz) calloc((n), (sz))
Packit e9ba0d
#define mm_strdup(s) strdup(s)
Packit e9ba0d
#define mm_realloc(p, sz) realloc((p), (sz))
Packit e9ba0d
#define mm_free(p) free(p)
Packit e9ba0d
#endif
Packit e9ba0d
Packit e9ba0d
#ifdef __cplusplus
Packit e9ba0d
}
Packit e9ba0d
#endif
Packit e9ba0d
Packit e9ba0d
#endif