The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/json: Add json getter

u_json_get() is much, much shorter than cJSON_GetObjectItemCaseSensitive().

authored by

Christoph Haag and committed by
Jakob Bornecrantz
74a328e9 e3b74c2e

+13
+6
src/xrt/auxiliary/util/u_json.c
··· 27 27 return cJSON_GetObjectItemCaseSensitive(json, f); 28 28 } 29 29 30 + const cJSON * 31 + u_json_get(const cJSON *json, const char *f) 32 + { 33 + return get(json, f); 34 + } 35 + 30 36 bool 31 37 u_json_get_string_into_array(const cJSON *json, char *out_str, size_t max_size) 32 38 {
+7
src/xrt/auxiliary/util/u_json.h
··· 20 20 extern "C" { 21 21 #endif // __cplusplus 22 22 23 + /*! 24 + * @brief Get a JSON object by string from a JSON object. 25 + * 26 + * @return The JSON object with the given name if successful, NULL if not. 27 + */ 28 + const cJSON * 29 + u_json_get(const cJSON *json, const char *f); 23 30 24 31 /*! 25 32 * @brief Parse a string from a JSON object into a char array.