YAJL  2.1.0
yajl_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2014, Lloyd Hilaiel <me@lloyd.io>
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef __YAJL_COMMON_H__
18 #define __YAJL_COMMON_H__
19 
20 #include <stddef.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define YAJL_MAX_DEPTH 128
27 
28 /* msft dll export gunk. To build a DLL on windows, you
29  * must define WIN32, YAJL_SHARED, and YAJL_BUILD. To use a shared
30  * DLL, you must define YAJL_SHARED and WIN32 */
31 #if (defined(_WIN32) || defined(WIN32)) && defined(YAJL_SHARED)
32 # ifdef YAJL_BUILD
33 # define YAJL_API __declspec(dllexport)
34 # else
35 # define YAJL_API __declspec(dllimport)
36 # endif
37 #else
38 # if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
39 # define YAJL_API __attribute__ ((visibility("default")))
40 # else
41 # define YAJL_API
42 # endif
43 #endif
44 
47 typedef void * (*yajl_malloc_func)(void *ctx, size_t sz);
48 
51 typedef void (*yajl_free_func)(void *ctx, void * ptr);
52 
54 typedef void * (*yajl_realloc_func)(void *ctx, void * ptr, size_t sz);
55 
58 typedef struct
59 {
68  void * ctx;
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif
yajl_free_func free
Definition: yajl_common.h:66
void *(* yajl_realloc_func)(void *ctx, void *ptr, size_t sz)
Definition: yajl_common.h:54
yajl_realloc_func realloc
Definition: yajl_common.h:63
void(* yajl_free_func)(void *ctx, void *ptr)
Definition: yajl_common.h:51
void * ctx
Definition: yajl_common.h:68
void *(* yajl_malloc_func)(void *ctx, size_t sz)
Definition: yajl_common.h:47
Definition: yajl_common.h:58
yajl_malloc_func malloc
Definition: yajl_common.h:61