-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improve performance of adding item to array #448
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1d1e308
format comment
Alanscut 18a5ea8
Merge branch 'master' of https://github.com/DaveGamble/cJSON
Alanscut d65668b
Merge branch 'master' of https://github.com/DaveGamble/cJSON
Alanscut 71dcbee
Merge branch 'master' of https://github.com/DaveGamble/cJSON
Alanscut ea6700f
Merge branch 'master' of https://github.com/DaveGamble/cJSON
Alanscut 4a5cb26
Merge branch 'master' of https://github.com/DaveGamble/cJSON
Alanscut db7810a
Merge branch 'master' of https://github.com/DaveGamble/cJSON
Alanscut c8fee8a
Merge branch 'master' of https://github.com/DaveGamble/cJSON
Alanscut 4498394
Merge branch 'master' of https://github.com/DaveGamble/cJSON
Alanscut d2fa120
fix bug of detach item
Alanscut 7d71b83
update test for cJSON_DetachItemViaPointer
Alanscut 648e856
Merge remote-tracking branch 'origin' into improve-add-item
Alanscut 05cdcac
use prev pointer when adding item to array
Alanscut dc38868
add testcase for cJSON_DeleteItemFromArray
Alanscut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//To cover more case, add below test would be better?
cJSON_AddItemToArray(array, item1);
cJSON_DeleteItemFromArray(array, 1);
str2 = cJSON_PrintUnformatted(root);
TEST_ASSERT_EQUAL_STRING(expected_json2, str2);
free(str2);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
item1
has been freed duringcJSON_DeleteItemFromArray(array, 0);
, so I have to copy it at first. besides, I think the test you supplemented won't pass:str2
is not equalexpected_json2
.could you provide a completely testcase? or use the
insert a suggestion
(ctrl+g) to give me a more detail clue?