API request: sqlite3_vconfig() and sqlite3_db_vconfig()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

API request: sqlite3_vconfig() and sqlite3_db_vconfig()

Stephen F. Booth
Hello,

I have a request for two API additions: sqlite3_vconfig() and
sqlite3_db_vconfig(). The naming convention is borrowed from vprintf() and
friends. The functions would be identical to sqlite3_config() and
sqlite3_db_config() except they would take a va_list instead of variadic
arguments.

The motivation for this is better interoperability with Swift. While Swift
supports calling most C functions natively, variadic functions are not
supported. Currently it isn't possible to call the _config() functions
without additional glue code.

The implementations are straightforward:

% diff sqlite3-3300000.h sqlite3+vconfigs.h
1560a1561,1562
> SQLITE_API int sqlite3_vconfig(int, va_list ap);
>
1579a1582,1583
> SQLITE_API int sqlite3_db_vconfig(sqlite3*, int op, va_list ap);
>


% diff sqlite3-3300000.c sqlite3+vconfigs.c
2602a2603,2604
> SQLITE_API int sqlite3_vconfig(int, va_list ap);
>
2621a2624,2625
> SQLITE_API int sqlite3_db_vconfig(sqlite3*, int op, va_list ap);
>
120640a120645,120646
> /* FIXME: Version 3.XX.XX and later */
> #define sqlite3_db_vconfig             sqlite3_api->db_vconfig
121112a121119,121120
>   /* FIXME: Version 3.XX.XX and later */
>   sqlite3_db_vconfig,
156586a156595,156601
>   va_start(ap, op);
>   int rc = sqlite3_vconfig(op, ap);
>   va_end(ap);
>   return rc;
> }
>
> SQLITE_API int sqlite3_vconfig(int op, va_list ap){
156593d156607
<   va_start(ap, op);
156888d156901
<   va_end(ap);
157035d157047
<   int rc;
157036a157049,157055
>   int rc = sqlite3_db_vconfig(db, op, ap);
>   va_end(ap);
>   return rc;
> }
>
> SQLITE_API int sqlite3_db_vconfig(sqlite3 *db, int op, va_list ap){
>   int rc;
157098d157116
<   va_end(ap);

Thanks,
Stephen
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users