mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-08 03:22:21 +03:00
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
This commit is contained in:
29
src/printf.c
29
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
|
||||
|
||||
Reference in New Issue
Block a user