diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-10-20 21:20:15 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-10-20 21:20:15 -0400 |
| commit | 873d76e7f9b4a803c92dc44bc92ef5565e74ca8e (patch) | |
| tree | 64326adbffef631f51fa108f625c613223d47d3a /lib/json.c | |
| parent | ce01a2ca3f4501b75e55fe325c150eb9c2ae329d (diff) | |
lib: Fix for int64 and json on some systems
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>
Diffstat (limited to 'lib/json.c')
| -rw-r--r-- | lib/json.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/json.c b/lib/json.c index ca30c60984..c49a4f9074 100644 --- a/lib/json.c +++ b/lib/json.c @@ -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 |
