diff options
author | Eric Haszlakiewicz <erh+git@nimenees.com> | 2017-11-27 17:57:36 -0500 |
---|---|---|
committer | Eric Haszlakiewicz <erh+git@nimenees.com> | 2017-11-27 17:57:36 -0500 |
commit | 3628f16dd6b68ba6bc18d22c4cd75be875a5e757 (patch) | |
tree | 9fb147e7c6f9d72aafce030474b53fa072caddf8 /json_object.c | |
parent | 91662a5b69a2ca5102e286b77e76e39736db17a3 (diff) | |
download | json-c-3628f16dd6b68ba6bc18d22c4cd75be875a5e757.tar.gz |
Rename json_object_add_int() to json_object_int_inc() and eliminate the "int64" variant since we store 64-bit values internally anyway.
Diffstat (limited to 'json_object.c')
-rw-r--r-- | json_object.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/json_object.c b/json_object.c index df20de1..ee6efe5 100644 --- a/json_object.c +++ b/json_object.c @@ -666,20 +666,6 @@ int json_object_set_int(struct json_object *jso,int new_value){ return 1; } -int json_object_add_int(struct json_object *jso, int val) { - if (!jso || jso->o_type != json_type_int) - return 0; - if (val > 0 && jso->o.c_int64 > INT32_MAX - val) { - jso->o.c_int64 = INT32_MAX; - } else if (val < 0 && jso->o.c_int64 < INT32_MIN - val) { - jso->o.c_int64 = INT32_MIN; - } else { - jso->o.c_int64 += val; - } - return 1; -} - - struct json_object* json_object_new_int64(int64_t i) { struct json_object *jso = json_object_new(json_type_int); @@ -724,7 +710,7 @@ int json_object_set_int64(struct json_object *jso,int64_t new_value){ return 1; } -int json_object_add_int64(struct json_object *jso, int64_t val) { +int json_object_int_inc(struct json_object *jso, int64_t val) { if (!jso || jso->o_type != json_type_int) return 0; if (val > 0 && jso->o.c_int64 > INT64_MAX - val) { |