• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/json-c-compat.h

  1 /*
  2  * Copyright (C) 2022 Jo-Philipp Wich <jo@mein.io>
  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 
 17 #ifndef JSON_C_COMPAT_H
 18 #define JSON_C_COMPAT_H
 19 
 20 #include <stddef.h>
 21 #include <stdint.h>
 22 #include <json-c/json.h>
 23 
 24 
 25 /* json-c compat */
 26 
 27 #ifndef HAVE_PARSE_END
 28 static inline size_t json_tokener_get_parse_end(struct json_tokener *tok) {
 29         return (size_t)tok->char_offset;
 30 }
 31 #endif
 32 
 33 #ifndef HAVE_ARRAY_EXT
 34 static inline struct json_object *json_object_new_array_ext(int size) {
 35         (void) size;
 36         return json_object_new_array();
 37 }
 38 #endif
 39 
 40 #ifndef HAVE_JSON_UINT64
 41 static inline struct json_object *json_object_new_uint64(uint64_t i) {
 42         return json_object_new_int64((int64_t)i);
 43 }
 44 
 45 static inline uint64_t json_object_get_uint64(const struct json_object *obj) {
 46         return (uint64_t)json_object_get_int64(obj);
 47 }
 48 #endif
 49 
 50 #endif /* JSON_C_COMPAT_H */
 51 

This page was automatically generated by LXR 0.3.1.  •  OpenWrt