apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <bo...@rexursive.com>
Subject Re: svn commit: r412252 - /apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c
Date Wed, 07 Jun 2006 23:58:29 GMT
Quoting Joe Orton <jorton@redhat.com>:

> This is really still a long way from "properly" - both the old and new
> code has undefined behaviour because of the function cast.

The following code, from apr_dbd.c, probably won't have an easy fix  
like the drivers did:

#define CLEANUP_CAST (apr_status_t (*)(void*))


APU_DECLARE(int) apr_dbd_transaction_start(const apr_dbd_driver_t *driver,
                                            apr_pool_t *pool,  
apr_dbd_t *handle,
                                            apr_dbd_transaction_t **trans)
     int ret = driver->start_transaction(pool, handle, trans);
     if (*trans) {
         apr_pool_cleanup_register(pool, *trans,
                                   CLEANUP_CAST driver->end_transaction,
     return ret;
APU_DECLARE(int) apr_dbd_transaction_end(const apr_dbd_driver_t *driver,
                                          apr_pool_t *pool,
                                          apr_dbd_transaction_t *trans)
     apr_pool_cleanup_kill(pool, trans, CLEANUP_CAST driver->end_transaction);
     return driver->end_transaction(trans);

We are just lucky here that driver->end_transaction() takes a txn  
pointer and returns an int, which is equivalent for most intents and  
puposes to (apr_status_t (*)(void*)).


View raw message