You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bo...@apache.org on 2006/06/07 14:11:04 UTC
svn commit: r412384 - in /apr/apr-util/trunk/dbd: apr_dbd_pgsql.c
apr_dbd_sqlite3.c
Author: bojan
Date: Wed Jun 7 05:11:03 2006
New Revision: 412384
URL: http://svn.apache.org/viewvc?rev=412384&view=rev
Log:
Don't cast cleanup functions, provide wrappers instead (PgSQL, SQLite3).
Modified:
apr/apr-util/trunk/dbd/apr_dbd_pgsql.c
apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c
Modified: apr/apr-util/trunk/dbd/apr_dbd_pgsql.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd_pgsql.c?rev=412384&r1=412383&r2=412384&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_pgsql.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_pgsql.c Wed Jun 7 05:11:03 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 {
@@ -464,7 +470,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/trunk/dbd/apr_dbd_sqlite3.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c?rev=412384&r1=412383&r2=412384&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_sqlite3.c Wed Jun 7 05:11:03 2006
@@ -287,11 +287,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;
}