Avoid redundant edits in the json_merge_patch() function.

FossilOrigin-Name: 4a8e6437dd610c5376a07867a73e5a7e2ea90357a018e1788ecce6f4e10bc939
This commit is contained in:
drh 2017-03-23 12:56:44 +00:00
parent 0002d246a9
commit 1fe162fd0c
3 changed files with 9 additions and 11 deletions

View File

@ -1393,10 +1393,8 @@ static JsonNode *jsonMergePatch(
assert( pTarget[j].eType==JSON_STRING );
assert( pTarget[j].jnFlags & JNODE_LABEL );
assert( (pPatch[i].jnFlags & JNODE_RAW)==0 );
if( (pTarget[j+1].jnFlags & (JNODE_REMOVE|JNODE_PATCH))==0
&& pTarget[j].n==nKey
&& strncmp(pTarget[j].u.zJContent, zKey, nKey)==0
){
if( pTarget[j].n==nKey && strncmp(pTarget[j].u.zJContent,zKey,nKey)==0 ){
if( pTarget[j+1].jnFlags & (JNODE_REMOVE|JNODE_PATCH) ) break;
if( pPatch[i+1].eType==JSON_NULL ){
pTarget[j+1].jnFlags |= JNODE_REMOVE;
}else{

View File

@ -1,5 +1,5 @@
C Fix\sharmless\scompiler\swarnings\sin\sthe\snew\sjson_merge_patch()\slogic.
D 2017-03-23T00:46:15.319
C Avoid\sredundant\sedits\sin\sthe\sjson_merge_patch()\sfunction.
D 2017-03-23T12:56:44.298
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 1faf9f06aadc9284c212dea7bbc7c0dea7e8337f0287c81001eff500912c790a
@ -218,7 +218,7 @@ F ext/misc/eval.c f971962e92ebb8b0a4e6b62949463ee454d88fa2
F ext/misc/fileio.c d4171c815d6543a9edef8308aab2951413cd8d0f
F ext/misc/fuzzer.c 7c64b8197bb77b7d64eff7cac7848870235d4c25
F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c
F ext/misc/json1.c bae7cfb49cda81be573fb159919b502a906940ccc1688dbaab33688489c9cf26
F ext/misc/json1.c dbb168b0a7640a896a565c647dcabb7c7d116c9d2b1a23b963b1d177edc0ddba
F ext/misc/memvfs.c e5225bc22e79dde6b28380f3a068ddf600683a33
F ext/misc/nextchar.c 35c8b8baacb96d92abbb34a83a997b797075b342
F ext/misc/percentile.c 92699c8cd7d517ff610e6037e56506f8904dae2e
@ -1568,7 +1568,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P f49fd2554b0723eb7cf2fd765d655c6820833ee7e5f7d7629d98c27a6fffa1d9
R b4e56917a91a0ee0d4fc1a8a4b3db16b
P 5d2cf5a2f8afd88d041d89b3936042ce5a43629d23c48738cb2791b24da3e6af
R 76e620c002fc08a86767847f533fe70a
U drh
Z 39d1ac0a1922cab73356f035d8da0baa
Z 538e213b7e95dcafcfcd2e7dd4b1a792

View File

@ -1 +1 @@
5d2cf5a2f8afd88d041d89b3936042ce5a43629d23c48738cb2791b24da3e6af
4a8e6437dd610c5376a07867a73e5a7e2ea90357a018e1788ecce6f4e10bc939