aboutsummaryrefslogtreecommitdiff
path: root/src/printf.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2006-06-26 21:35:44 +0000
committerdrh <drh@noemail.net>2006-06-26 21:35:44 +0000
commit28dd479c481498a46579f569d02177f8864dfaac (patch)
tree44ebab6ddd8b37f57a0f28d934a7e71d709fc71c /src/printf.c
parent1914619ae780c0486cea869a139cd087b2a2edfb (diff)
downloadsqlite-28dd479c481498a46579f569d02177f8864dfaac.tar.gz
sqlite-28dd479c481498a46579f569d02177f8864dfaac.zip
Publish APIs sqlite3_malloc() and sqlite3_realloc() that use the OS-layer
memory allocator. Convert sqlite3_free() and sqlite3_mprintf() to also use the OS-layer memory allocator. (CVS 3298) FossilOrigin-Name: 85a66a25e97471d3c459c8da6a96990b0537dc7d
Diffstat (limited to 'src/printf.c')
-rw-r--r--src/printf.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/printf.c b/src/printf.c
index 7e62c9c38..b4c37fb61 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -806,29 +806,28 @@ char *sqlite3MPrintf(const char *zFormat, ...){
}
/*
-** Print into memory obtained from malloc(). Do not use the internal
-** %-conversion extensions. This routine is for use by external users.
+** Print into memory obtained from sqlite3_malloc(). Omit the internal
+** %-conversion extensions.
+*/
+char *sqlite3_vmprintf(const char *zFormat, va_list ap){
+ char zBase[SQLITE_PRINT_BUF_SIZE];
+ return base_vprintf(sqlite3_realloc, 0, zBase, sizeof(zBase), zFormat, ap);
+}
+
+/*
+** Print into memory obtained from sqlite3_malloc()(). Omit the internal
+** %-conversion extensions.
*/
char *sqlite3_mprintf(const char *zFormat, ...){
va_list ap;
char *z;
- char zBuf[200];
-
- va_start(ap,zFormat);
- z = base_vprintf((void*(*)(void*,int))realloc, 0,
- zBuf, sizeof(zBuf), zFormat, ap);
+ char zBase[SQLITE_PRINT_BUF_SIZE];
+ va_start(ap, zFormat);
+ z = base_vprintf(sqlite3_realloc, 0, zBase, sizeof(zBase), zFormat, ap);
va_end(ap);
return z;
}
-/* This is the varargs version of sqlite3_mprintf.
-*/
-char *sqlite3_vmprintf(const char *zFormat, va_list ap){
- char zBuf[200];
- return base_vprintf((void*(*)(void*,int))realloc, 0,
- zBuf, sizeof(zBuf), zFormat, ap);
-}
-
/*
** sqlite3_snprintf() works like snprintf() except that it ignores the
** current locale settings. This is important for SQLite because we