]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the sqlite3_vsnprintf() interface.
authordrh <drh@noemail.net>
Wed, 5 Jan 2011 12:20:09 +0000 (12:20 +0000)
committerdrh <drh@noemail.net>
Wed, 5 Jan 2011 12:20:09 +0000 (12:20 +0000)
FossilOrigin-Name: fc67adea414320e0c0b24054f76070cfaeebb401

manifest
manifest.uuid
src/printf.c
src/sqlite.h.in

index 494390ee4d86aa420d4bf8abed3177a306538ab1..c7260b994de87489d6fb1cfbe1a14d8f2a923c77 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-C Fix\sa\snull-pointer\sdereference\sthat\scan\soccur\son\san\sOOM\serror\swhile\srunning\nANALYZE\swith\sSQLITE_ENABLE_STAT2.
-D 2011-01-04T20:06:33
+C Add\sthe\ssqlite3_vsnprintf()\sinterface.
+D 2011-01-05T12:20:09
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in de6498556d536ae60bb8bb10e8c1ba011448658c
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -173,13 +173,13 @@ F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
 F src/pcache1.c e9578a3beac26f229ee558a4e16c863f2498185f
 F src/pragma.c 8a6cd3c787f882fa44f6490d2411fc26839ce8f3
 F src/prepare.c c8b877b80721d70b68053fd9ae30ec6d63eeeadc
-F src/printf.c 8ae5082dd38a1b5456030c3755ec3a392cd51506
+F src/printf.c 37e8bfd4c5a04eae4960adbe776b0f1fc4cad674
 F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
 F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
 F src/select.c 8a7ba246b0b4bb45df7fbc52681728a0e3deaaa7
 F src/shell.c 83c6f0cc5a79a081c7b9ddfe4f557b47e0bad976
-F src/sqlite.h.in b1cee73c93ce5e00bc112a9092f31fb22f5bbdde
+F src/sqlite.h.in 8ee5a78674f9b78a59a0313197a46892204e3407
 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754
 F src/sqliteInt.h 3ef5fc89a4c9755a08a68de107493785a284e27c
 F src/sqliteLimit.h a17dcd3fb775d63b64a43a55c54cb282f9726f44
@@ -898,14 +898,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P a5867cfc4c9b9155fa345247dec29e38fffa8002
-R 33920abd29ec7da3a05c7b6407d444e4
+P 73128d4ef5d7703bf7af0553c307b55dc1b783f6
+R 22f3c024ddce8fb34edcc7b2ba2f47cc
 U drh
-Z fee44c23be46975276d6ff90647b1cd8
+Z 7a7101ec3b07503edbe1e87dcccedd8b
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
-iD8DBQFNI348oxKgR168RlERArxzAJ48mvtLODhvrcwzodfd2cfkKQoKAgCfTW4G
-KYtbHKKaTCI2uRFS5jBRYsE=
-=uWmE
+iD8DBQFNJGH9oxKgR168RlERApc5AJ0YgtPklZ+P441lEcNlotS284XXhwCdF7KS
+vpLjG17hnHrqRDNqDYunPRg=
+=hyLY
 -----END PGP SIGNATURE-----
index 23399c4ad783298ef0b7ab278f191da4a95af82d..adfaf67b0fc6f6567f1da769426d2a5e60cb04dc 100644 (file)
@@ -1 +1 @@
-73128d4ef5d7703bf7af0553c307b55dc1b783f6
\ No newline at end of file
+fc67adea414320e0c0b24054f76070cfaeebb401
\ No newline at end of file
index da2fdf610df5ed771b86e44b65e2f6ddeea5ea2f..755355de0ce7ec965950e6ba9f211439d6f3c22c 100644 (file)
@@ -934,21 +934,28 @@ char *sqlite3_mprintf(const char *zFormat, ...){
 ** current locale settings.  This is important for SQLite because we
 ** are not able to use a "," as the decimal point in place of "." as
 ** specified by some locales.
+**
+** Oops:  The first two arguments of sqlite3_snprintf() are backwards
+** from the snprintf() standard.  Unfortunately, it is too late to change
+** this without breaking compatibility, so we just have to live with the
+** mistake.
+**
+** sqlite3_vsnprintf() is the varargs version.
 */
-char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
-  char *z;
-  va_list ap;
+char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){
   StrAccum acc;
-
-  if( n<=0 ){
-    return zBuf;
-  }
+  if( n<=0 ) return zBuf;
   sqlite3StrAccumInit(&acc, zBuf, n, 0);
   acc.useMalloc = 0;
-  va_start(ap,zFormat);
   sqlite3VXPrintf(&acc, 0, zFormat, ap);
+  return sqlite3StrAccumFinish(&acc);
+}
+char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
+  char *z;
+  va_list ap;
+  va_start(ap,zFormat);
+  z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);
   va_end(ap);
-  z = sqlite3StrAccumFinish(&acc);
   return z;
 }
 
index 77b0aad6399740baaefcb3e9bf241bcb8cf39336..5aaeb4a10fa14b2cb20966effee7d4aa398135fc 100644 (file)
@@ -1861,6 +1861,8 @@ void sqlite3_free_table(char **result);
 ** the zero terminator.  So the longest string that can be completely
 ** written will be n-1 characters.
 **
+** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().
+**
 ** These routines all implement some additional formatting
 ** options that are useful for constructing SQL statements.
 ** All of the usual printf() formatting options apply.  In addition, there
@@ -1924,6 +1926,7 @@ void sqlite3_free_table(char **result);
 char *sqlite3_mprintf(const char*,...);
 char *sqlite3_vmprintf(const char*, va_list);
 char *sqlite3_snprintf(int,char*,const char*, ...);
+char *sqlite3_vsnprintf(int,char*,const char*, va_list);
 
 /*
 ** CAPI3REF: Memory Allocation Subsystem