1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Use memmove() rather than a home-made copy loop in insertCell() too.

FossilOrigin-Name: a3d796b1673ca68ced247d63c22ddcfb1f9d56ea
This commit is contained in:
drh
2013-12-09 02:32:19 +00:00
parent 9bb7c4ff4f
commit 8f518837f9
3 changed files with 8 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
C Use\smemmove()\srather\sthan\sa\shome-made\scopy\sloop\sin\sdropCell()\sof\sbtree.c,\nfor\sa\ssize\sreduction\sand\sperformance\simprovement. C Use\smemmove()\srather\sthan\sa\shome-made\scopy\sloop\sin\sinsertCell()\stoo.
D 2013-12-09T01:58:11.109 D 2013-12-09T02:32:19.333
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in e1a9b4258bbde53f5636f4e238c65b7e11459e2b F Makefile.in e1a9b4258bbde53f5636f4e238c65b7e11459e2b
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -166,7 +166,7 @@ F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
F src/backup.c 1809a7caa2504233bdddd12f5018422421789537 F src/backup.c 1809a7caa2504233bdddd12f5018422421789537
F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb F src/bitvec.c 19a4ba637bd85f8f63fc8c9bae5ade9fb05ec1cb
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7 F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
F src/btree.c ac25a91a1ec94b361b09fdd99253b248ab0bbefc F src/btree.c 432c3e22ff76e8ee1caf57ff88ba9f8af1fcfc30
F src/btree.h a61ddebc78c66795a2b93181321a116746302cc9 F src/btree.h a61ddebc78c66795a2b93181321a116746302cc9
F src/btreeInt.h f038e818bfadf75afbd09819ed93c26a333d39e0 F src/btreeInt.h f038e818bfadf75afbd09819ed93c26a333d39e0
F src/build.c 9b40580b62916612678bdb69ce0286e39c29a862 F src/build.c 9b40580b62916612678bdb69ce0286e39c29a862
@@ -1146,7 +1146,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
P 81f5ae13b2e23daee03151d32515387b7f5ba5e5 P 78e1706804e88a0dd5dc40bee838a3a504cfa53b
R dff255530828faccbaffbe7aa2a8b29a R 3d219561bfa9f63d670ef18564ca91c7
U drh U drh
Z 8d4fe309cbbd963b83317f42164d5ecb Z a11cf025d0d9777faa558f3c1da4ce10

View File

@@ -1 +1 @@
78e1706804e88a0dd5dc40bee838a3a504cfa53b a3d796b1673ca68ced247d63c22ddcfb1f9d56ea

View File

@@ -5733,9 +5733,6 @@ static void insertCell(
int ins; /* Index in data[] where new cell pointer is inserted */ int ins; /* Index in data[] where new cell pointer is inserted */
int cellOffset; /* Address of first cell pointer in data[] */ int cellOffset; /* Address of first cell pointer in data[] */
u8 *data; /* The content of the whole page */ u8 *data; /* The content of the whole page */
u8 *ptr; /* Used for moving information around in data[] */
u8 *endPtr; /* End of the loop */
int nSkip = (iChild ? 4 : 0); int nSkip = (iChild ? 4 : 0);
if( *pRC ) return; if( *pRC ) return;
@@ -5786,13 +5783,7 @@ static void insertCell(
if( iChild ){ if( iChild ){
put4byte(&data[idx], iChild); put4byte(&data[idx], iChild);
} }
ptr = &data[end]; memmove(&data[ins+2], &data[ins], end-ins);
endPtr = &data[ins];
assert( (SQLITE_PTR_TO_INT(ptr)&1)==0 ); /* ptr is always 2-byte aligned */
while( ptr>endPtr ){
*(u16*)ptr = *(u16*)&ptr[-2];
ptr -= 2;
}
put2byte(&data[ins], idx); put2byte(&data[ins], idx);
put2byte(&data[pPage->hdrOffset+3], pPage->nCell); put2byte(&data[pPage->hdrOffset+3], pPage->nCell);
#ifndef SQLITE_OMIT_AUTOVACUUM #ifndef SQLITE_OMIT_AUTOVACUUM