This is Unofficial EPICS BASE Doxygen Site
yajl_alloc.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>
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 
23 #include <stdlib.h>
24 
25 #include "yajl_alloc.h"
26 
27 static void * yajl_internal_malloc(void *ctx, size_t sz)
28 {
29  return malloc(sz);
30 }
31 
32 static void * yajl_internal_realloc(void *ctx, void * previous,
33  size_t sz)
34 {
35  return realloc(previous, sz);
36 }
37 
38 static void yajl_internal_free(void *ctx, void * ptr)
39 {
40  free(ptr);
41 }
42 
44 {
45  yaf->malloc = yajl_internal_malloc;
46  yaf->free = yajl_internal_free;
47  yaf->realloc = yajl_internal_realloc;
48  yaf->ctx = NULL;
49 }
50 
yajl_free_func free
Definition: yajl_common.h:75
#define NULL
Definition: catime.c:38
Memory allocation macros for yajl.
void yajl_set_default_alloc_funcs(yajl_alloc_funcs *yaf)
Definition: yajl_alloc.c:43
yajl_realloc_func realloc
Definition: yajl_common.h:72
yajl_malloc_func malloc
Definition: yajl_common.h:70