1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Remove the sqlite3_open_varargs() API. (CVS 1515)

FossilOrigin-Name: 6902fb1b49fdf0e38265fa26198690243cdc2f58
This commit is contained in:
danielk1977
2004-06-01 00:03:52 +00:00
parent f20b21c8fd
commit d1a2553ae6
4 changed files with 10 additions and 109 deletions

View File

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.201 2004/05/31 23:56:43 danielk1977 Exp $
** $Id: main.c,v 1.202 2004/06/01 00:03:53 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -1108,88 +1108,6 @@ int sqlite3_open16(
return rc;
}
/*
** Open a new database handle.
*/
int sqlite3_open_vararg(
const char *filename, /* Database filename (UTF-8) */
sqlite3 **ppDb, /* OUT: SQLite db handle */
... /* Option strings */
){
va_list ap;
const char **aOpts = 0;
int nOpts = 0;
int rc;
/* Count the arguments */
va_start(ap, ppDb);
while( va_arg(ap, const char *) ) nOpts++;
va_end(ap);
/* If there are more than zero arguments, construct an array */
if( nOpts ){
aOpts = (const char **)sqliteMalloc(sizeof(const char *)*nOpts+1);
if( !aOpts ){
*ppDb = 0;
return SQLITE_NOMEM;
}
va_start(ap, ppDb);
nOpts = 0;
while( va_arg(ap, const char *) ){
aOpts[nOpts] = va_arg(ap, const char *);
nOpts++;
}
aOpts[nOpts] = 0;
va_end(ap);
}
/* Call the regular sqlite3_open() */
rc = sqlite3_open(filename, ppDb, aOpts);
if( aOpts ) sqliteFree(aOpts);
return rc;
}
/*
** Open a new database handle.
*/
int sqlite3_open16_vararg(
const void *filename, /* Database filename (UTF-16) */
sqlite3 **ppDb, /* OUT: SQLite db handle */
... /* Option strings */
){
va_list ap;
const char **aOpts = 0;
int nOpts = 0;
int rc;
/* Count the arguments */
va_start(ap, ppDb);
while( va_arg(ap, const char *) ) nOpts++;
va_end(ap);
/* If there are more than zero arguments, construct an array */
if( nOpts ){
aOpts = (const char **)sqliteMalloc(sizeof(const char *)*nOpts+1);
if( !aOpts ){
*ppDb = 0;
return SQLITE_NOMEM;
}
va_start(ap, ppDb);
nOpts = 0;
while( va_arg(ap, const char *) ){
aOpts[nOpts] = va_arg(ap, const char *);
nOpts++;
}
aOpts[nOpts] = 0;
va_end(ap);
}
/* Call the regular sqlite3_open16() */
rc = sqlite3_open16(filename, ppDb, aOpts);
if( aOpts ) sqliteFree(aOpts);
return rc;
}
/*
** The following routine destroys a virtual machine that is created by
** the sqlite3_compile() routine. The integer returned is an SQLITE_