2 * Copyright (c) 2009 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
12 #include "hashtable.h"
14 #define container_of(ptr_, type_, member_) \
15 ((type_ *)((char *)ptr_ - (size_t)&((type_ *)0)->member_))
19 hashtable_t hashtable;
46 #define json_to_object(json_) container_of(json_, json_object_t, json)
47 #define json_to_array(json_) container_of(json_, json_array_t, json)
48 #define json_to_string(json_) container_of(json_, json_string_t, json)
49 #define json_to_real(json_) container_of(json_, json_real_t, json)
50 #define json_to_integer(json_) container_of(json_, json_integer_t, json)
52 int json_object_set_nocheck(json_t *json, const char *key, json_t *value);
53 json_t *json_string_nocheck(const char *value);