apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Gross <mail...@devspace.com>
Subject A Typecast problem
Date Sat, 05 Oct 2002 20:32:40 GMT

For specific purposes I decided to get a clean download of APR again.  And 
I found that I have the hook typecast problem again.  We talked about this 
in the middle of May.

Specifically I would like a typecast  by the apr_array_push function since 
in C++ this will not compile because apr_array_push returns a void *, but 
pHook is defined to be of type ns##_LINK_##name##_t.  And C++ will not 
accept this conversion.

So could this be patched?  (Thanks)

#define APR_IMPLEMENT_EXTERNAL_HOOK_BASE2(ns,link,name) \
link##_DECLARE(void) ns##_hook_##name(ns##_HOOK_##name##_t *pf,const char * 
const *aszPre, \
                                       const char * const *aszSucc,int 
nOrder) \
     { \
     ns##_LINK_##name##_t *pHook; \
     if(!_hooks.link_##name) \
         { \
         _hooks.link_##name=apr_array_make(apr_hook_global_pool,1,sizeof(ns##_LINK_##name##_t));

\
         apr_hook_sort_register(#name,&_hooks.link_##name); \
         } \
     pHook=(ns##_LINK_##name##_t *)apr_array_push(_hooks.link_##name); \
     pHook->pFunc=pf; \
     pHook->aszPredecessors=aszPre; \
     pHook->aszSuccessors=aszSucc; \
     pHook->nOrder=nOrder; \
     pHook->szName=apr_hook_debug_current; \
     if(apr_hook_debug_enabled) \
         apr_hook_debug_show(#name,aszPre,aszSucc); \
     } \
     APR_IMPLEMENT_HOOK_GET_PROTO(ns,link,name) \
     { \
         return _hooks.link_##name; \
     }


Christian Gross
Software Engineering Consultant
http://www.devspace.com
North America: 1-450-675-4208
Europe +41.1.701.1166


Mime
View raw message