You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2020/11/23 14:38:59 UTC
svn commit: r1883749 - /apr/apr/trunk/memory/unix/apr_pools.c
Author: ylavic
Date: Mon Nov 23 14:38:59 2020
New Revision: 1883749
URL: http://svn.apache.org/viewvc?rev=1883749&view=rev
Log:
apr_pools: fix __attribute__((nonnull)) warning in [pre_]cleanup_register.
Since apr_[pre_]cleanup_register() functions are declared ((nonnull)) for
plain_cleanup_fn and child_cleanup_fn, the compiler (gcc-9 here) issues a
warning when we check them for !NULL is the code.
To preserve APR_POOL_DEBUG checks still with compilers that don't support
this __attribute__, let's work around this by checking NULL values afterward
for c, c->plain_cleanup_fn and c->child_cleanup_fn.
Modified:
apr/apr/trunk/memory/unix/apr_pools.c
Modified: apr/apr/trunk/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/memory/unix/apr_pools.c?rev=1883749&r1=1883748&r2=1883749&view=diff
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Mon Nov 23 14:38:59 2020
@@ -2519,14 +2519,10 @@ APR_DECLARE(void) apr_pool_cleanup_regis
apr_status_t (*plain_cleanup_fn)(void *data),
apr_status_t (*child_cleanup_fn)(void *data))
{
- cleanup_t *c;
+ cleanup_t *c = NULL;
#if APR_POOL_DEBUG
apr_pool_check_integrity(p);
-
- if (!p || !plain_cleanup_fn || !child_cleanup_fn) {
- abort();
- }
#endif /* APR_POOL_DEBUG */
if (p != NULL) {
@@ -2543,12 +2539,18 @@ APR_DECLARE(void) apr_pool_cleanup_regis
c->next = p->cleanups;
p->cleanups = c;
}
+
+#if APR_POOL_DEBUG
+ if (!c || !c->plain_cleanup_fn || !c->child_cleanup_fn) {
+ abort();
+ }
+#endif /* APR_POOL_DEBUG */
}
APR_DECLARE(void) apr_pool_pre_cleanup_register(apr_pool_t *p, const void *data,
apr_status_t (*plain_cleanup_fn)(void *data))
{
- cleanup_t *c;
+ cleanup_t *c = NULL;
#if APR_POOL_DEBUG
apr_pool_check_integrity(p);
@@ -2567,6 +2569,12 @@ APR_DECLARE(void) apr_pool_pre_cleanup_r
c->next = p->pre_cleanups;
p->pre_cleanups = c;
}
+
+#if APR_POOL_DEBUG
+ if (!c || !c->plain_cleanup_fn) {
+ abort();
+ }
+#endif /* APR_POOL_DEBUG */
}
APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,