apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject svn commit: r412385 - in /apr/apr-util/branches/1.2.x/dbd: apr_dbd_pgsql.c apr_dbd_sqlite3.c
Date Wed, 07 Jun 2006 12:13:10 GMT
Author: bojan
Date: Wed Jun  7 05:13:09 2006
New Revision: 412385

URL: http://svn.apache.org/viewvc?rev=412385&view=rev
Log:
Merge r412384 from trunk to 1.2.x branch
Original message:
Don't cast cleanup functions, provide wrappers instead (PgSQL, SQLite3).

Modified:
    apr/apr-util/branches/1.2.x/dbd/apr_dbd_pgsql.c
    apr/apr-util/branches/1.2.x/dbd/apr_dbd_sqlite3.c

Modified: apr/apr-util/branches/1.2.x/dbd/apr_dbd_pgsql.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.2.x/dbd/apr_dbd_pgsql.c?rev=412385&r1=412384&r2=412385&view=diff
==============================================================================
--- apr/apr-util/branches/1.2.x/dbd/apr_dbd_pgsql.c (original)
+++ apr/apr-util/branches/1.2.x/dbd/apr_dbd_pgsql.c Wed Jun  7 05:13:09 2006
@@ -69,6 +69,12 @@
                                  || ((x) == PGRES_COMMAND_OK) \
                                  || ((x) == PGRES_TUPLES_OK))
 
+static apr_status_t clear_result(void *data)
+{
+    PQclear(data);
+    return APR_SUCCESS;
+}
+
 static int dbd_pgsql_select(apr_pool_t *pool, apr_dbd_t *sql,
                             apr_dbd_results_t **results,
                             const char *query, int seek)
@@ -103,7 +109,7 @@
         (*results)->ntuples = PQntuples(res);
         (*results)->sz = PQnfields(res);
         (*results)->random = seek;
-        apr_pool_cleanup_register(pool, res, (void*)PQclear,
+        apr_pool_cleanup_register(pool, res, clear_result,
                                   apr_pool_cleanup_null);
     }
     else {
@@ -459,7 +465,7 @@
         (*results)->ntuples = PQntuples(res);
         (*results)->sz = PQnfields(res);
         (*results)->random = seek;
-        apr_pool_cleanup_register(pool, res, (void*)PQclear,
+        apr_pool_cleanup_register(pool, res, clear_result,
                                   apr_pool_cleanup_null);
     }
     else {

Modified: apr/apr-util/branches/1.2.x/dbd/apr_dbd_sqlite3.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.2.x/dbd/apr_dbd_sqlite3.c?rev=412385&r1=412384&r2=412385&view=diff
==============================================================================
--- apr/apr-util/branches/1.2.x/dbd/apr_dbd_sqlite3.c (original)
+++ apr/apr-util/branches/1.2.x/dbd/apr_dbd_sqlite3.c Wed Jun  7 05:13:09 2006
@@ -299,11 +299,17 @@
     return ret;
 }
 
+static apr_status_t free_mem(void *data)
+{
+    sqlite3_free(data);
+    return APR_SUCCESS;
+}
+
 static const char *dbd_sqlite3_escape(apr_pool_t *pool, const char *arg,
                                       apr_dbd_t *sql)
 {
     char *ret = sqlite3_mprintf("%q", arg);
-    apr_pool_cleanup_register(pool, ret, (void *) sqlite3_free,
+    apr_pool_cleanup_register(pool, ret, free_mem,
                               apr_pool_cleanup_null);
     return ret;
 }



Mime
View raw message