summaryrefslogtreecommitdiff
path: root/tables/apr_tables.c
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2007-04-26 13:53:44 +0000
committerJoe Orton <jorton@apache.org>2007-04-26 13:53:44 +0000
commit9ac7311a2e77181baecd9e171d1a83c44d3cc9f2 (patch)
treef62880800454f0aa94ca62064df59670416bec15 /tables/apr_tables.c
parentdda7d5605c4c0bfa983fdacaa7686fa96851c4df (diff)
downloadapr-9ac7311a2e77181baecd9e171d1a83c44d3cc9f2.tar.gz
* tables/apr_tables.c [MAKE_TABLE_PROFILE] (do_table_push): Rename
from table_push and fix implementation per 1.3's alloc.c, with extension to print invoking function name if built with GCC. PR: 41950 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@532744 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tables/apr_tables.c')
-rw-r--r--tables/apr_tables.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/tables/apr_tables.c b/tables/apr_tables.c
index 54b6eb069..90fcaf887 100644
--- a/tables/apr_tables.c
+++ b/tables/apr_tables.c
@@ -38,7 +38,7 @@
#include <strings.h>
#endif
-#if APR_POOL_DEBUG && APR_HAVE_STDIO_H
+#if (APR_POOL_DEBUG || defined(MAKE_TABLE_PROFILE)) && APR_HAVE_STDIO_H
#include <stdio.h>
#endif
@@ -357,13 +357,19 @@ struct apr_table_t {
* and table_elts() in alloc.h
*/
#ifdef MAKE_TABLE_PROFILE
-static apr_table_entry_t *table_push(apr_table_t *t)
+static apr_table_entry_t *do_table_push(const char *func, apr_table_t *t)
{
if (t->a.nelts == t->a.nalloc) {
- return NULL;
+ fprintf(stderr, "%s: table created by %p hit limit of %u\n",
+ func ? func : "table_push", t->creator, t->a.nalloc);
}
return (apr_table_entry_t *) apr_array_push_noclear(&t->a);
}
+#if defined(__GNUC__) && __GNUC__ >= 2
+#define table_push(t) do_table_push(__FUNCTION__, t)
+#else
+#define table_push(t) do_table_push(NULL, t)
+#endif
#else /* MAKE_TABLE_PROFILE */
#define table_push(t) ((apr_table_entry_t *) apr_array_push_noclear(&(t)->a))
#endif /* MAKE_TABLE_PROFILE */