mirror of
https://github.com/json-c/json-c.git
synced 2026-03-30 02:19:06 +08:00
Rewrite json_object_object_add to replace just the value if the key already exists so keys remain valid.
This is particularly useful when replacing values in a loop, since it allows the key used by json_object_object_foreach to continue to be used.
This commit is contained in:
9
tests/testReplaceExisting.expected
Normal file
9
tests/testReplaceExisting.expected
Normal file
@@ -0,0 +1,9 @@
|
||||
Key at index 0 is [foo1]
|
||||
Key at index 1 is [foo2]
|
||||
replacing value for key [foo2]
|
||||
Key at index 2 is [foo3]
|
||||
==== second loop starting ====
|
||||
Key at index 0 is [foo1]
|
||||
Key at index 1 is [foo2]
|
||||
pointer for key [foo2] does match
|
||||
Key at index 2 is [foo3]
|
||||
Reference in New Issue
Block a user