Quoting Joe Orton <[EMAIL PROTECTED]>:

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*))

[..snip..]

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,
                                  apr_pool_cleanup_null);
    }
    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*)).

--
Bojan

Reply via email to