apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roo...@apache.org
Subject svn commit: r231376 - in /apr/apr-util/trunk: dbd/apr_dbd_pgsql.c dbd/apr_dbd_sqlite2.c dbd/apr_dbd_sqlite3.c include/private/apr_dbd_internal.h
Date Thu, 11 Aug 2005 02:35:27 GMT
Author: rooneg
Date: Wed Aug 10 19:35:25 2005
New Revision: 231376

URL: http://svn.apache.org/viewcvs?rev=231376&view=rev
Log:
Be a bit more correct in our handling of varargs in the DBD code.

* include/private/apr_dbd_internal.h
  (apr_dbd_driver_t::pvquery,
   apr_dbd_driver_t::pvselect): take a va_list, not ...

* dbd/apr_dbd_sqlite2.c
  (dbd_sqlite_pvquery,
   dbd_sqlite_pvselect): take a va_list arg.  not that it really matters
   since this just returns ENOTIMPL...

* dbd/apr_dbd_sqlite3.c
  (dbd_sqlite3_pvquery,
   dbd_sqlite3_pvselect): ditto.

* dbd/apr_dbd_pgsql.c
  (dbd_pgsql_pvquery,
   dbd_pgsql_pvselect): take va_list args, as such stop doing va_start and
   va_end, since it's already been done in the upper level wrapper function.

Modified:
    apr/apr-util/trunk/dbd/apr_dbd_pgsql.c
    apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c
    apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
    apr/apr-util/trunk/include/private/apr_dbd_internal.h

Modified: apr/apr-util/trunk/dbd/apr_dbd_pgsql.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd_pgsql.c?rev=231376&r1=231375&r2=231376&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_pgsql.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_pgsql.c Wed Aug 10 19:35:25 2005
@@ -378,17 +378,16 @@
 }
 
 static int dbd_pgsql_pvquery(apr_pool_t *pool, apr_dbd_t *sql,
-                             int *nrows, apr_dbd_prepared_t *statement, ...)
+                             int *nrows, apr_dbd_prepared_t *statement,
+                             va_list args)
 {
     const char *arg;
     int nargs = 0;
-    va_list args;
     const char *values[QUERY_MAX_ARGS];
 
     if (sql->trans && sql->trans->errnum) {
         return sql->trans->errnum;
     }
-    va_start(args, statement);
     while ( arg = va_arg(args, const char*), arg ) {
         if ( nargs >= QUERY_MAX_ARGS) {
             va_end(args);
@@ -396,7 +395,6 @@
         }
         values[nargs++] = apr_pstrdup(pool, arg);
     }
-    va_end(args);
     values[nargs] = NULL;
     return dbd_pgsql_pquery(pool, sql, nrows, statement, nargs, values);
 }
@@ -477,18 +475,16 @@
 static int dbd_pgsql_pvselect(apr_pool_t *pool, apr_dbd_t *sql,
                               apr_dbd_results_t **results,
                               apr_dbd_prepared_t *statement,
-                              int seek, ...)
+                              int seek, va_list args)
 {
     const char *arg;
     int nargs = 0;
-    va_list args;
     const char *values[QUERY_MAX_ARGS];
 
     if (sql->trans && sql->trans->errnum) {
         return sql->trans->errnum;
     }
 
-    va_start(args, seek);
     while (arg = va_arg(args, const char*), arg) {
         if ( nargs >= QUERY_MAX_ARGS) {
             va_end(args);
@@ -496,7 +492,6 @@
         }
         values[nargs++] = apr_pstrdup(pool, arg);
     }
-    va_end(args);
     return dbd_pgsql_pselect(pool, sql, results, statement,
                              seek, nargs, values) ;
 }

Modified: apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c?rev=231376&r1=231375&r2=231376&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c Wed Aug 10 19:35:25 2005
@@ -241,7 +241,8 @@
 }
 
 static int dbd_sqlite_pvquery(apr_pool_t * pool, apr_dbd_t * sql,
-                              int *nrows, apr_dbd_prepared_t * statement, ...)
+                              int *nrows, apr_dbd_prepared_t * statement,
+                              va_list args)
 {
     return APR_ENOTIMPL;
 }
@@ -256,7 +257,8 @@
 
 static int dbd_sqlite_pvselect(apr_pool_t * pool, apr_dbd_t * sql,
                                apr_dbd_results_t ** results,
-                               apr_dbd_prepared_t * statement, int seek, ...)
+                               apr_dbd_prepared_t * statement, int seek,
+                               va_list args)
 {
     return APR_ENOTIMPL;
 }

Modified: apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c?rev=231376&r1=231375&r2=231376&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c Wed Aug 10 19:35:25 2005
@@ -299,7 +299,7 @@
 }
 
 static int dbd_sqlite3_pvquery(apr_pool_t *pool, apr_dbd_t *sql, int *nrows,
-                               apr_dbd_prepared_t *statement, ...)
+                               apr_dbd_prepared_t *statement, va_list args)
 {
     return APR_ENOTIMPL;
 }
@@ -314,7 +314,8 @@
 
 static int dbd_sqlite3_pvselect(apr_pool_t *pool, apr_dbd_t *sql,
                                 apr_dbd_results_t **results,
-                                apr_dbd_prepared_t *statement, int seek, ...)
+                                apr_dbd_prepared_t *statement, int seek,
+                                va_list args)
 {
     return APR_ENOTIMPL;
 }

Modified: apr/apr-util/trunk/include/private/apr_dbd_internal.h
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/include/private/apr_dbd_internal.h?rev=231376&r1=231375&r2=231376&view=diff
==============================================================================
--- apr/apr-util/trunk/include/private/apr_dbd_internal.h (original)
+++ apr/apr-util/trunk/include/private/apr_dbd_internal.h Wed Aug 10 19:35:25 2005
@@ -203,11 +203,11 @@
      *  @param handle - the connection
      *  @param nrows - number of rows affected.
      *  @param statement - the prepared statement to execute
-     *  @param ... - args to prepared statement
+     *  @param args - args to prepared statement
      *  @return 0 for success or error code
      */
     int (*pvquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows,
-                   apr_dbd_prepared_t *statement, ...);
+                   apr_dbd_prepared_t *statement, va_list args);
 
     /** pvselect: select using a prepared statement + args
      *
@@ -216,12 +216,12 @@
      *  @param res - pointer to query results.  May point to NULL on entry
      *  @param statement - the prepared statement to execute
      *  @param random - Whether to support random-access to results
-     *  @param ... - args to prepared statement
+     *  @param args - args to prepared statement
      *  @return 0 for success or error code
      */
     int (*pvselect)(apr_pool_t *pool, apr_dbd_t *handle,
                     apr_dbd_results_t **res,
-                    apr_dbd_prepared_t *statement, int random, ...);
+                    apr_dbd_prepared_t *statement, int random, va_list args);
 
     /** pquery: query using a prepared statement + args
      *



Mime
View raw message