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 16:10:43 UTC
svn commit: r1883752 - in /apr/apr/branches/1.7.x: ./ memory/unix/apr_pools.c
Author: ylavic
Date: Mon Nov 23 16:10:43 2020
New Revision: 1883752
URL: http://svn.apache.org/viewvc?rev=1883752&view=rev
Log:
Merge r1883749 from trunk:
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/branches/1.7.x/ (props changed)
apr/apr/branches/1.7.x/memory/unix/apr_pools.c
Propchange: apr/apr/branches/1.7.x/
------------------------------------------------------------------------------
Merged /apr/apr/trunk:r1883749
Modified: apr/apr/branches/1.7.x/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/memory/unix/apr_pools.c?rev=1883752&r1=1883751&r2=1883752&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/memory/unix/apr_pools.c (original)
+++ apr/apr/branches/1.7.x/memory/unix/apr_pools.c Mon Nov 23 16:10:43 2020
@@ -2511,14 +2511,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) {
@@ -2535,12 +2531,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);
@@ -2559,6 +2561,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,