]> git.feebdaed.xyz Git - 0xmirror/cJSON.git/commitdiff
feat: set list head's prev in parse_array and parse_object
authormiaoerduo <zhaoyu3210@foxmail.com>
Fri, 3 Apr 2020 03:52:54 +0000 (11:52 +0800)
committerzhaoyu <zhaoyu@sensetime.com>
Fri, 3 Apr 2020 09:20:42 +0000 (17:20 +0800)
cJSON.c

diff --git a/cJSON.c b/cJSON.c
index a5d39878c29ad8b42f29851744c587f61ea01181..500fcf574fdc4a2aa79b662505d42276df11f7f6 100644 (file)
--- a/cJSON.c
+++ b/cJSON.c
@@ -1509,6 +1509,10 @@ static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buf
 success:
     input_buffer->depth--;
 
+    if (head != NULL) {
+        head->prev = current_item;
+    }
+
     item->type = cJSON_Array;
     item->child = head;
 
@@ -1681,6 +1685,10 @@ static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_bu
 success:
     input_buffer->depth--;
 
+    if (head != NULL) {
+        head->prev = current_item;
+    }
+
     item->type = cJSON_Object;
     item->child = head;