]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Adjust memory size computations to avoid a conditional that is always
authordrh <drh@noemail.net>
Sat, 25 Jul 2009 17:42:21 +0000 (17:42 +0000)
committerdrh <drh@noemail.net>
Sat, 25 Jul 2009 17:42:21 +0000 (17:42 +0000)
false on 64-bit systems. (CVS 6942)

FossilOrigin-Name: 04211e6af9cdd3e7f19b458c72b722f8f8584245

manifest
manifest.uuid
src/vdbeaux.c

index faae73aec65901c44c28135d13db7ff4c62c866b..09fae42a2075450887d502f786939ebec97936e8 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Change\san\sunreachable\scondition\sin\sPagerSharedLock\sto\sa\sNEVER(...).\sAdd\san\sassert\sto\spager_error()\sto\sshow\sthat\sit\sis\snever\scalled\sto\sput\san\sin-memory\spager\sto\sthe\serror-state.\s(CVS\s6941)
-D 2009-07-25T17:39:14
+C Adjust\smemory\ssize\scomputations\sto\savoid\sa\sconditional\sthat\sis\salways\nfalse\son\s64-bit\ssystems.\s(CVS\s6942)
+D 2009-07-25T17:42:22
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -208,7 +208,7 @@ F src/vdbe.c 0ce57f8211899b59d1d6f1642f79e75fc212d6d0
 F src/vdbe.h 457b6c70f02885cec1f5225b5e6441d067b55d3f
 F src/vdbeInt.h 831c254a6eef237ef4664c8381a0137586567007
 F src/vdbeapi.c 0ab8ada7260b32031ca97f338caecf0812460624
-F src/vdbeaux.c e3943dae17dd29d749a3e9bb42e4eb7b7eca43ed
+F src/vdbeaux.c e57911d2c8d9b482d8ddd87a10fa50df14a9e095
 F src/vdbeblob.c a3f3e0e877fc64ea50165eec2855f5ada4477611
 F src/vdbemem.c bfc25f9ef4fa914b473303566459552bdb2e008a
 F src/vtab.c b19c4e96dcf2b89b5b2ba48e8ef624e654a59b2c
@@ -738,7 +738,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P 10250fe5c039dbef2e1614e6320f7bd354c10211
-R 99775dd1d9caf07f15aac6d35493d7a6
-U danielk1977
-Z 48c380c40fd307d2d3f58af91056b3e0
+P 1d931f77519baf3586708c77cbd161c0e75bcbaf
+R 1a0264645a22cb518a2f7e53ba7c8b67
+U drh
+Z 524f3fe5a603b07a7180f1e927937f4d
index 522dec353ea7435052c186336ab26573d2aa9f8a..f34d57ef7b92d714ec6a6b4f85a3c532cbf89db2 100644 (file)
@@ -1 +1 @@
-1d931f77519baf3586708c77cbd161c0e75bcbaf
\ No newline at end of file
+04211e6af9cdd3e7f19b458c72b722f8f8584245
\ No newline at end of file
index b09c741bf0882333b48f50cfa04489ed3c852d67..1c0908d5b5cbd4b31eb38b7911ff3265d7429b92 100644 (file)
@@ -14,7 +14,7 @@
 ** to version 2.8.7, all this code was combined into the vdbe.c source file.
 ** But that file was getting too big so this subroutines were split out.
 **
-** $Id: vdbeaux.c,v 1.478 2009/07/24 17:58:53 danielk1977 Exp $
+** $Id: vdbeaux.c,v 1.479 2009/07/25 17:42:22 drh Exp $
 */
 #include "sqliteInt.h"
 #include "vdbeInt.h"
@@ -1064,7 +1064,7 @@ static void allocSpace(
   assert( EIGHT_BYTE_ALIGNMENT(*ppFrom) );
   if( (*(void**)pp)==0 ){
     nByte = ROUND8(nByte);
-    if( (pEnd - *ppFrom)>=nByte ){
+    if( &(*ppFrom)[nByte] <= pEnd ){
       *(void**)pp = (void *)*ppFrom;
       *ppFrom += nByte;
     }else{
@@ -1135,12 +1135,11 @@ void sqlite3VdbeMakeReady(
     if( isExplain && nMem<10 ){
       nMem = 10;
     }
+    memset(zCsr, 0, zEnd-zCsr);
     zCsr += (zCsr - (u8*)0)&7;
     assert( EIGHT_BYTE_ALIGNMENT(zCsr) );
-    if( zEnd<zCsr ) zEnd = zCsr;
 
     do {
-      memset(zCsr, 0, zEnd-zCsr);
       nByte = 0;
       allocSpace((char*)&p->aMem, nMem*sizeof(Mem), &zCsr, zEnd, &nByte);
       allocSpace((char*)&p->aVar, nVar*sizeof(Mem), &zCsr, zEnd, &nByte);
@@ -1150,7 +1149,7 @@ void sqlite3VdbeMakeReady(
                  nCursor*sizeof(VdbeCursor*), &zCsr, zEnd, &nByte
       );
       if( nByte ){
-        p->pFree = sqlite3DbMallocRaw(db, nByte);
+        p->pFree = sqlite3DbMallocZero(db, nByte);
       }
       zCsr = p->pFree;
       zEnd = &zCsr[nByte];