yajl_common.h
Go to the documentation of this file.
/*
* Copyright (c) 2007-2014, Lloyd Hilaiel <me@lloyd.io>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __YAJL_COMMON_H__
#define __YAJL_COMMON_H__
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#define YAJL_MAX_DEPTH 128
/* msft dll export gunk. To build a DLL on windows, you
* must define WIN32, YAJL_SHARED, and YAJL_BUILD. To use a shared
* DLL, you must define YAJL_SHARED and WIN32 */
#if (defined(_WIN32) || defined(WIN32)) && defined(YAJL_SHARED)
# ifdef YAJL_BUILD
# define YAJL_API __declspec(dllexport)
# else
# define YAJL_API __declspec(dllimport)
# endif
#else
# if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
# define YAJL_API __attribute__ ((visibility("default")))
# else
# define YAJL_API
# endif
#endif
typedef void * (*yajl_malloc_func)(void *ctx, size_t sz);
typedef void (*yajl_free_func)(void *ctx, void * ptr);
typedef void * (*yajl_realloc_func)(void *ctx, void * ptr, size_t sz);
typedef struct
{
yajl_malloc_func malloc;
yajl_realloc_func realloc;
yajl_free_func free;
void * ctx;
} yajl_alloc_funcs;
#ifdef __cplusplus
}
#endif
#endif
yajl_alloc_funcs
Definition yajl_common.h:59
yajl_alloc_funcs::free
yajl_free_func free
Definition yajl_common.h:66
yajl_alloc_funcs::malloc
yajl_malloc_func malloc
Definition yajl_common.h:61
yajl_alloc_funcs::realloc
yajl_realloc_func realloc
Definition yajl_common.h:63
yajl_alloc_funcs::ctx
void * ctx
Definition yajl_common.h:68
yajl_free_func
void(* yajl_free_func)(void *ctx, void *ptr)
Definition yajl_common.h:51
yajl_realloc_func
void *(* yajl_realloc_func)(void *ctx, void *ptr, size_t sz)
Definition yajl_common.h:54
yajl_malloc_func
void *(* yajl_malloc_func)(void *ctx, size_t sz)
Definition yajl_common.h:47