aboutsummaryrefslogtreecommitdiff
path: root/src/printf.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2003-01-29 18:46:51 +0000
committerdrh <drh@noemail.net>2003-01-29 18:46:51 +0000
commit483750ba8a9c6527d8e6c7ea53b78801c4ce0d95 (patch)
tree9fa2ae9560400444a898248be446ccc68d51a278 /src/printf.c
parent326dce74511a963dba56c046a86e82193c44e128 (diff)
downloadsqlite-483750ba8a9c6527d8e6c7ea53b78801c4ce0d95.tar.gz
sqlite-483750ba8a9c6527d8e6c7ea53b78801c4ce0d95.zip
Better error messages on constraint violations. Additional tests and bug fixes
for the callback-free API. (CVS 854) FossilOrigin-Name: ccc82f1ab4539a60ee5cc2625743c5389f9ccd8e
Diffstat (limited to 'src/printf.c')
-rw-r--r--src/printf.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/printf.c b/src/printf.c
index 1ef6f42ce..387ea1c2d 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -684,6 +684,28 @@ static void mout(void *arg, char *zNewText, int nNewChar){
** resulting string and returns a pointer to the allocated memory. Use
** sqliteFree() to release the memory allocated.
*/
+char *sqliteMPrintf(const char *zFormat, ...){
+ va_list ap;
+ struct sgMprintf sMprintf;
+ char *zNew;
+ char zBuf[200];
+
+ sMprintf.nChar = 0;
+ sMprintf.nAlloc = sizeof(zBuf);
+ sMprintf.zText = zBuf;
+ sMprintf.zBase = zBuf;
+ va_start(ap,zFormat);
+ vxprintf(mout,&sMprintf,zFormat,ap);
+ va_end(ap);
+ sMprintf.zText[sMprintf.nChar] = 0;
+ return sqliteRealloc(sMprintf.zText, sMprintf.nChar+1);
+}
+
+/*
+** sqlite_mprintf() works like printf(), but allocations memory to hold the
+** resulting string and returns a pointer to the allocated memory. Use
+** sqliteFree() to release the memory allocated.
+*/
char *sqlite_mprintf(const char *zFormat, ...){
va_list ap;
struct sgMprintf sMprintf;