brianp 2002/07/13 00:08:41
Modified: include apr_tables.h
tables apr_tables.c
Log:
Changed apr_table_elts() and apr_is_empty_table() from macros
to functions to make apr_table_t a fully abstract type
Revision Changes Path
1.32 +2 -3 apr/include/apr_tables.h
Index: apr_tables.h
===================================================================
RCS file: /home/cvs/apr/include/apr_tables.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- apr_tables.h 5 Jul 2002 05:39:01 -0000 1.31
+++ apr_tables.h 13 Jul 2002 07:08:41 -0000 1.32
@@ -125,15 +125,14 @@
* @param t The table
* @return An array containing the contents of the table
*/
-#define apr_table_elts(t) ((const apr_array_header_t *)(t))
+APR_DECLARE(const apr_array_header_t *) apr_table_elts(const apr_table_t *t);
/**
* Determine if the table is empty
* @param t The table to check
* @return True if empty, False otherwise
*/
-#define apr_is_empty_table(t) (((t) == NULL) \
- || (((apr_array_header_t *)(t))->nelts == 0))
+APR_DECLARE(int) apr_is_empty_table(const apr_table_t *t);
/**
* Create an array
1.35 +9 -0 apr/tables/apr_tables.c
Index: apr_tables.c
===================================================================
RCS file: /home/cvs/apr/tables/apr_tables.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- apr_tables.c 6 Jul 2002 08:13:35 -0000 1.34
+++ apr_tables.c 13 Jul 2002 07:08:41 -0000 1.35
@@ -368,6 +368,15 @@
#define table_push(t) ((apr_table_entry_t *)
apr_array_push_noclear(&(t)->a))
#endif /* MAKE_TABLE_PROFILE */
+APR_DECLARE(const apr_array_header_t *) apr_table_elts(const apr_table_t *t)
+{
+ return (const apr_array_header_t *)t;
+}
+
+APR_DECLARE(int) apr_is_empty_table(const apr_table_t *t)
+{
+ return ((t == NULL) || (t->a.nelts == 0));
+}
APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, int nelts)
{