From: drh Date: Wed, 1 Sep 2010 14:45:16 +0000 (+0000) Subject: Make all private routines in test_quota.c begin with "quota". X-Git-Tag: experimental~87^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61cc423aa3c8c147abf46039ab9a84474a6ef278;p=thirdparty%2Fsqlite.git Make all private routines in test_quota.c begin with "quota". Fix a test_quota.c segfault when setting a zero-quota. FossilOrigin-Name: c0d0fc3a1cca7ee28db8add745c71baf0545776c --- diff --git a/manifest b/manifest index ebafdadb9d..58d0ccff43 100644 --- a/manifest +++ b/manifest @@ -1,8 +1,8 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -C Add\sthe\ssqlite3_quota_dump\stest\scommand.\s\sAdd\sa\sdestructor\sargument\son\nthe\ssqlite3_quota_set()\sinterface. -D 2010-09-01T14:35:49 +C Make\sall\sprivate\sroutines\sin\stest_quota.c\sbegin\swith\s"quota".\nFix\sa\stest_quota.c\ssegfault\swhen\ssetting\sa\szero-quota. +D 2010-09-01T14:45:16 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in c599a15d268b1db2aeadea19df2adc3bf2eb6bee F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -211,7 +211,7 @@ F src/test_mutex.c ce06b59aca168cd8c520b77159a24352a7469bd3 F src/test_onefile.c 40cf9e212a377a6511469384a64b01e6e34b2eec F src/test_osinst.c f408c6a181f2fb04c56273afd5c3e1e82f60392c F src/test_pcache.c 7bf828972ac0d2403f5cfa4cd14da41f8ebe73d8 -F src/test_quota.c 92015bbb781f58a7073d03a4faf9981e46d679c4 +F src/test_quota.c 8c28bb3f66a8bc90a458f16876ebaa89e4bbad3e F src/test_rtree.c e957a603a98871dcf005c1e96ae791cfe74eb7f6 F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0 F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6 @@ -565,7 +565,7 @@ F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc F test/quick.test 1681febc928d686362d50057c642f77a02c62e57 -F test/quota.test e6ea65a69ab79e77a9945d97004204fd6d8c3d97 +F test/quota.test a2faf03b630bf9d6dc03d5f4cf18ddb7ef1b2372 F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6 F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459 F test/randexpr1.test 1084050991e9ba22c1c10edd8d84673b501cc25a @@ -856,14 +856,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P c1eec7dba698e5bad0870cb80079203f0fb89514 -R 5ccdd6b5ff8c4a7fd8c3537f33664271 +P 7a624b5ae2abff21bcbbb34af88d1c7656f3b729 +R 4041710572588b49cf8e3c314659cdde U drh -Z 37a3d6817393597a2d599801ebf7d8b4 +Z c4eac6ed50191a086b6db4a1d87dd5c9 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) -iD8DBQFMfmTIoxKgR168RlERAkXOAJ9rg479NHW8icHIeLtH5Tt3WleCsQCfVywb -rV5uQ2LKNw+EzD5POJ3VPYQ= -=vORW +iD8DBQFMfmb+oxKgR168RlERAualAJ4oGP4giCs27HA69gTkp0EaPArqVwCdEPwb +lAxAbOSJt/sYZvU7C3FlLw0= +=nKqo -----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index e1c19f426f..67a012f598 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7a624b5ae2abff21bcbbb34af88d1c7656f3b729 \ No newline at end of file +c0d0fc3a1cca7ee28db8add745c71baf0545776c \ No newline at end of file diff --git a/src/test_quota.c b/src/test_quota.c index 1e372ca9cc..3790b5721c 100644 --- a/src/test_quota.c +++ b/src/test_quota.c @@ -178,7 +178,7 @@ static void quotaGroupDeref(quotaGroup *p){ ** [^...] Matches one character not in the enclosed list. ** */ -static int strglob(const char *zGlob, const char *z){ +static int quotaStrglob(const char *zGlob, const char *z){ int c, c2; int invert; int seen; @@ -191,7 +191,7 @@ static int strglob(const char *zGlob, const char *z){ if( c==0 ){ return 1; }else if( c=='[' ){ - while( *z && strglob(zGlob-1,z)==0 ){ + while( *z && quotaStrglob(zGlob-1,z)==0 ){ z++; } return (*z)!=0; @@ -201,7 +201,7 @@ static int strglob(const char *zGlob, const char *z){ c2 = *(z++); if( c2==0 ) return 0; } - if( strglob(zGlob,z) ) return 1; + if( quotaStrglob(zGlob,z) ) return 1; } return 0; }else if( c=='?' ){ @@ -249,7 +249,8 @@ static int strglob(const char *zGlob, const char *z){ */ static quotaGroup *quotaGroupFind(const char *zFilename){ quotaGroup *p; - for(p=gQuota.pGroup; p && strglob(p->zPattern, zFilename)==0; p=p->pNext){} + for(p=gQuota.pGroup; p && quotaStrglob(p->zPattern, zFilename)==0; + p=p->pNext){} return p; } @@ -661,8 +662,12 @@ int sqlite3_quota_set( while( pGroup && strcmp(pGroup->zPattern, zPattern)!=0 ){ pGroup = pGroup->pNext; } - if( pGroup==0 && iLimit>0 ){ + if( pGroup==0 ){ int nPattern = strlen(zPattern); + if( iLimit<=0 ){ + quotaLeave(); + return SQLITE_OK; + } pGroup = sqlite3_malloc( sizeof(*pGroup) + nPattern + 1 ); if( pGroup==0 ){ quotaLeave(); diff --git a/test/quota.test b/test/quota.test index 2890fe0624..82d04aa7ef 100644 --- a/test/quota.test +++ b/test/quota.test @@ -167,6 +167,18 @@ do_test quota-4.2 { sqlite3_quota_set *test.db 4096 {} quota_list } {*test.db} +do_test quota-4.3 { + sqlite3_quota_set *test2.db 0 {} + quota_list +} {*test.db} +do_test quota-4.4 { + sqlite3_quota_set *test2.db 12345 {} + quota_list +} {*test.db *test2.db} +do_test quota-4.5 { + sqlite3_quota_set *test.db 0 {} + quota_list +} {*test2.db} sqlite3_quota_shutdown