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 2007/04/26 15:53:45 UTC
svn commit: r532744 - /apr/apr/trunk/tables/apr_tables.c
Author: jorton
Date: Thu Apr 26 06:53:44 2007
New Revision: 532744
URL: http://svn.apache.org/viewvc?view=rev&rev=532744
Log:
* 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
Modified:
apr/apr/trunk/tables/apr_tables.c
Modified: apr/apr/trunk/tables/apr_tables.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/tables/apr_tables.c?view=diff&rev=532744&r1=532743&r2=532744
==============================================================================
--- apr/apr/trunk/tables/apr_tables.c (original)
+++ apr/apr/trunk/tables/apr_tables.c Thu Apr 26 06:53:44 2007
@@ -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 @@
* 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 */