2 * Copyright (c) 2009, 2010 Petri Lehtinen <petri@digip.org>
4 * Jansson is free software; you can redistribute it and/or modify
5 * it under the terms of the MIT license. See LICENSE for details.
8 #ifndef JANSSON_PRIVATE_H
9 #define JANSSON_PRIVATE_H
13 #include "hashtable.h"
15 #define container_of(ptr_, type_, member_) \
16 ((type_ *)((char *)ptr_ - offsetof(type_, member_)))
18 /* On some platforms, max() may already be defined */
20 #define max(a, b) ((a) > (b) ? (a) : (b))
25 hashtable_t hashtable;
53 #define json_to_object(json_) container_of(json_, json_object_t, json)
54 #define json_to_array(json_) container_of(json_, json_array_t, json)
55 #define json_to_string(json_) container_of(json_, json_string_t, json)
56 #define json_to_real(json_) container_of(json_, json_real_t, json)
57 #define json_to_integer(json_) container_of(json_, json_integer_t, json)
64 const object_key_t *jsonp_object_iter_fullkey(void *iter);
66 void jsonp_error_init(json_error_t *error, const char *source);
67 void jsonp_error_set(json_error_t *error, int line, int column,
68 const char *msg, ...);