From: drh Date: Sat, 25 Jul 2009 17:42:21 +0000 (+0000) Subject: Adjust memory size computations to avoid a conditional that is always X-Git-Tag: cvs-to-fossil-cutover~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bdd7191cc6cd6045f5acf7e854296679c97e5f8f;p=thirdparty%2Fsqlite.git Adjust memory size computations to avoid a conditional that is always false on 64-bit systems. (CVS 6942) FossilOrigin-Name: 04211e6af9cdd3e7f19b458c72b722f8f8584245 --- diff --git a/manifest b/manifest index faae73aec6..09fae42a20 100644 --- 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 diff --git a/manifest.uuid b/manifest.uuid index 522dec353e..f34d57ef7b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1d931f77519baf3586708c77cbd161c0e75bcbaf \ No newline at end of file +04211e6af9cdd3e7f19b458c72b722f8f8584245 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index b09c741bf0..1c0908d5b5 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -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( zEndaMem, 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];