The json_object_object_get_ex function is not fully available
across all versions of json. Write a wrapper to allow
it to work.
Ticket: CM-13872
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
{
json_object_put(obj);
}
+
+#if !defined(HAVE_JSON_C_JSON_H)
+int
+json_object_object_get_ex(struct json_object *obj,
+ const char *key,
+ struct json_object **value)
+{
+ *value = json_object_object_get(obj, key);
+
+ if (*value)
+ return 1;
+
+ return 0;
+}
+#endif
* so let's just turn it back to the original usage.
*/
#define json_object_to_json_string_ext(A, B) json_object_to_json_string (A)
+
+extern int json_object_object_get_ex(struct json_object *obj,
+ const char *key,
+ struct json_object **value);
#endif
#include "command.h"