diff --git a/src/dump.c b/src/dump.c index 33112ba..089474d 100644 --- a/src/dump.c +++ b/src/dump.c @@ -159,8 +159,10 @@ static int object_key_compare_keys(const void *key1, const void *key2) static int object_key_compare_serials(const void *key1, const void *key2) { - return (*(const object_key_t **)key1)->serial - - (*(const object_key_t **)key2)->serial; + size_t a = (*(const object_key_t **)key1)->serial; + size_t b = (*(const object_key_t **)key2)->serial; + + return a < b ? -1 : a == b ? 0 : 1; } static int do_dump(const json_t *json, size_t flags, int depth, diff --git a/src/value.c b/src/value.c index d0517d5..5ef4138 100644 --- a/src/value.c +++ b/src/value.c @@ -186,7 +186,9 @@ int json_object_clear(json_t *json) return -1; object = json_to_object(json); + hashtable_clear(&object->hashtable); + object->serial = 0; return 0; }