On Sun, Sep 27, 2009 at 10:59 AM, Guenter Knauf <fua...@apache.org> wrote:

> Hi,
> Jie Gao schrieb:
>
>> Building shared: mod_dbd.la
>> /usr/local/src/httpd-2.2.14/srclib/apr/libtool --silent --mode=compile
>> /opt/SUNWspro/bin/cc -g  -fast  -DSOLARIS2=10 -D_POSIX_PTHREAD_SEMANTICS
>> -D_REENTRANT -D_LARGEFILE64_SOURCE -DAP_DEBUG
>>  -I/usr/local/src/httpd-2.2.14/srclib/pcre -I.
>> -I/usr/local/src/httpd-2.2.14/os/unix
>> -I/usr/local/src/httpd-2.2.14/server/mpm/worker
>> -I/usr/local/src/httpd-2.2.14/modules/http
>> -I/usr/local/src/httpd-2.2.14/modules/filters
>> -I/usr/local/src/httpd-2.2.14/modules/proxy
>> -I/usr/local/src/httpd-2.2.14/include
>> -I/usr/local/src/httpd-2.2.14/modules/generators
>> -I/usr/local/src/httpd-2.2.14/modules/mappers
>> -I/usr/local/src/httpd-2.2.14/modules/database
>> -I/usr/local/src/httpd-2.2.14/srclib/apr/include
>> -I/usr/local/src/httpd-2.2.14/srclib/apr-util/include
>> -I/usr/local/src/httpd-2.2.14/srclib/apr-util/xml/expat/lib
>> -I/usr/local/src/httpd-2.2.14/modules/proxy/../generators -I/usr/sfw/include
>> -I/usr/local/src/httpd-2.2.14/modules/ssl
>> -I/usr/local/src/httpd-2.2.14/modules/dav/main -prefer-pic -c mod_d
>>
> bd.c && touch mod_dbd.slo
>
>> "mod_dbd.c", line 898: warning: argument #1 is incompatible with
>> prototype:
>>        prototype: pointer to function(pointer to struct apr_pool_t {},
>> pointer to struct server_rec {pointer to struct process_rec {..} process,
>> pointer to struct server_rec {..} next, pointer to const char defn_name,
>> unsigned int defn_line_number, pointer to char server_admin, pointer to char
>> server_hostname, unsigned short port, pointer to char error_fname, pointer
>> to struct apr_file_t {..} error_log, int loglevel, int is_virtual, pointer
>> to struct ap_conf_vector_t {..} module_config, pointer to struct
>> ap_conf_vector_t {..} lookup_defaults, pointer to struct server_addr_rec
>> {..} addrs, long long timeout, long long keep_alive_timeout, int
>> keep_alive_max, int keep_alive, pointer to const char path, int pathlen,
>>
> that's a strange one ...
>
> with other modules we pass functions of prototype:
> static void x_child_init(apr_pool_t *p, server_rec *s)
> to:
>    ap_hook_child_init(x_child_init, NULL, NULL, APR_HOOK_MIDDLE);
>
> where in mod_dbd.c our init function prototype is:
> static apr_status_t dbd_setup_init(apr_pool_t *pool, server_rec *s)
> then we pass it in line 898 as:
>    ap_hook_child_init((void*)dbd_setup_init, NULL, NULL, APR_HOOK_MIDDLE);
>
> seems a bit strange to me why the init function has another prototype as
> what we actually need - and I see no other place from where dbd_setup_init()
> is called and the return value would be used ??
>

I can only guess that the developer wished that child_init allowed the
function to return something, implemented it that way, and then cast the
function pointer to void * to avoid compile failures.

It was subsequently fixed on trunk by imposing this function:

static void dbd_child_init(apr_pool_t *p, server_rec *s)
{
  apr_status_t rv = dbd_setup_init(p, s);
  if (rv) {
    ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
                 "DBD: child init failed!");
  }
}

We should backport the same change to 2.2.x.

Reply via email to