You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2004/02/06 13:52:38 UTC
cvs commit: apr-util/include apr_optional.h apr_optional_hooks.h
jorton 2004/02/06 04:52:38
Modified: include apr_optional.h apr_optional_hooks.h
Log:
* include/apr_optional.h (APR_REGISTER_OPTIONAL_FN),
include/apr_optional_hooks.h (APR_OPTIONAL_HOOK): Rewrite to avoid
calling a function through a function pointer of incompatible type,
which is not conformant C99 code (by section 6.3.2.3 para 8) and
triggers a warning from gcc 3.4.
Reviewed by: Ben Laurie
Revision Changes Path
1.13 +5 -4 apr-util/include/apr_optional.h
Index: apr_optional.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_optional.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -b -d -u -r1.12 -r1.13
--- apr_optional.h 16 Nov 2003 01:50:10 -0000 1.12
+++ apr_optional.h 6 Feb 2004 12:52:38 -0000 1.13
@@ -1,7 +1,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2004 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -105,9 +105,10 @@
* confusingly but correctly, the function itself can be static!
* @param name The name of the function
*/
-#define APR_REGISTER_OPTIONAL_FN(name) \
- (((void (*)(const char *, APR_OPTIONAL_FN_TYPE(name) *)) \
- &apr_dynamic_fn_register)(#name,name))
+#define APR_REGISTER_OPTIONAL_FN(name) do { \
+ APR_OPTIONAL_FN_TYPE(name) *apu__opt = name; \
+ apr_dynamic_fn_register(#name,(apr_opt_fn_t *)apu__opt); \
+} while (0)
/** @internal
* Private function! DO NOT USE!
1.10 +5 -5 apr-util/include/apr_optional_hooks.h
Index: apr_optional_hooks.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_optional_hooks.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -b -d -u -r1.9 -r1.10
--- apr_optional_hooks.h 1 Jan 2003 00:02:20 -0000 1.9
+++ apr_optional_hooks.h 6 Feb 2004 12:52:38 -0000 1.10
@@ -1,7 +1,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
+ * Copyright (c) 2000-2004 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -99,10 +99,10 @@
* @param nOrder an integer determining order before honouring aszPre and aszSucc (for example HOOK_MIDDLE)
*/
-#define APR_OPTIONAL_HOOK(ns,name,pfn,aszPre,aszSucc,nOrder) \
- ((void (APR_THREAD_FUNC *)(const char *,ns##_HOOK_##name##_t *,const char * const *, \
- const char * const *,int))&apr_optional_hook_add)(#name,pfn,aszPre, \
- aszSucc, nOrder)
+#define APR_OPTIONAL_HOOK(ns,name,pfn,aszPre,aszSucc,nOrder) do { \
+ ns##_HOOK_##name##_t *apu__hook = pfn; \
+ apr_optional_hook_add(#name,(void (*)(void))apu__hook,aszPre, aszSucc, nOrder); \
+} while (0)
/**
* @internal