]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Fix for int64 and json on some systems
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 21 Oct 2016 01:20:15 +0000 (21:20 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 21 Oct 2016 01:20:15 +0000 (21:20 -0400)
When compiling json on systems with json/json.h
that don't have json_object_new_int64, just
use json_object_new_int instead and accept
we might truncate data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/json.c

index ca30c60984ab8fc0718a0b5d2b6147ab5f52246c..c49a4f907447fa91f1e11f4dc437752a723bad03 100644 (file)
@@ -56,7 +56,11 @@ json_object_int_add(struct json_object* obj, const char *key, int32_t i)
 void
 json_object_long_add(struct json_object* obj, const char *key, int64_t i)
 {
+#if defined(HAVE_JSON_C_JSON_H)
   json_object_object_add(obj, key, json_object_new_int64(i));
+#else
+  json_object_object_add(obj, key, json_object_new_int((int)i));
+#endif
 }
 
 void