2 * Copyright (c) 2009-2011 Petri Lehtinen <petri@digip.org>
3 * Copyright (c) 2011 Basile Starynkevitch <basile@starynkevitch.net>
5 * Jansson is free software; you can redistribute it and/or modify it
6 * under the terms of the MIT license. See LICENSE for details.
13 #include "jansson_private.h"
15 /* memory function pointers */
16 static json_malloc_t do_malloc = malloc;
17 static json_free_t do_free = free;
19 void *jsonp_malloc(size_t size)
24 return (*do_malloc)(size);
27 void jsonp_free(void *ptr)
35 char *jsonp_strdup(const char *str)
39 new_str = jsonp_malloc(strlen(str) + 1);
47 void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn)
49 do_malloc = malloc_fn;