diff options
Diffstat (limited to 'src/jansson/jansson_private.h')
-rw-r--r-- | src/jansson/jansson_private.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/jansson/jansson_private.h b/src/jansson/jansson_private.h index 7d6d09d..c6f437c 100644 --- a/src/jansson/jansson_private.h +++ b/src/jansson/jansson_private.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2012 Petri Lehtinen <petri@digip.org> + * Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org> * * Jansson is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. @@ -49,6 +49,7 @@ typedef struct { typedef struct { json_t json; char *value; + size_t length; } json_string_t; typedef struct { @@ -64,9 +65,13 @@ typedef struct { #define json_to_object(json_) container_of(json_, json_object_t, json) #define json_to_array(json_) container_of(json_, json_array_t, json) #define json_to_string(json_) container_of(json_, json_string_t, json) -#define json_to_real(json_) container_of(json_, json_real_t, json) +#define json_to_real(json_) container_of(json_, json_real_t, json) #define json_to_integer(json_) container_of(json_, json_integer_t, json) +/* Create a string by taking ownership of an existing buffer */ +json_t *jsonp_stringn_nocheck_own(const char *value, size_t len); + +/* Error message formatting */ void jsonp_error_init(json_error_t *error, const char *source); void jsonp_error_set_source(json_error_t *error, const char *source); void jsonp_error_set(json_error_t *error, int line, int column, @@ -81,7 +86,9 @@ int jsonp_dtostr(char *buffer, size_t size, double value); /* Wrappers for custom memory functions */ void* jsonp_malloc(size_t size); void jsonp_free(void *ptr); +char *jsonp_strndup(const char *str, size_t length); char *jsonp_strdup(const char *str); +char *jsonp_strndup(const char *str, size_t len); /* Windows compatibility */ #ifdef _WIN32 |