diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2002-06-28 14:04:36 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2002-06-28 14:04:36 +0000 |
commit | 1fa05e37f6f113be4895fb6163b9fdec04208557 (patch) | |
tree | b29a9755310feb755d20f96ba8d6aba203b385d3 | |
parent | 6b2b336dda2df63f876a66f8ec225d18459b2aa9 (diff) | |
download | libapr-1fa05e37f6f113be4895fb6163b9fdec04208557.tar.gz |
Introduce apr_table_do_callback_fn_t as a prototype declaration, and
consistify all broken APR_DECLARE() prototypes that were, in fact, always
handled as APR_DECLARE_NONSTD() by the MSVC compiler. Unfortunately, no
emit is raised when the compiler ignores our APR_DECLARE() semantic.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63527 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | file_io/os2/readwrite.c | 3 | ||||
-rw-r--r-- | file_io/unix/readwrite.c | 3 | ||||
-rw-r--r-- | file_io/win32/readwrite.c | 3 | ||||
-rw-r--r-- | include/apr_file_io.h | 3 | ||||
-rw-r--r-- | include/apr_tables.h | 18 | ||||
-rw-r--r-- | tables/apr_tables.c | 9 |
6 files changed, 29 insertions, 10 deletions
diff --git a/file_io/os2/readwrite.c b/file_io/os2/readwrite.c index 21492e47c..faeee1bb3 100644 --- a/file_io/os2/readwrite.c +++ b/file_io/os2/readwrite.c @@ -351,7 +351,8 @@ APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) -APR_DECLARE(int) apr_file_printf(apr_file_t *fptr, const char *format, ...) +APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, + const char *format, ...) { int cc; va_list ap; diff --git a/file_io/unix/readwrite.c b/file_io/unix/readwrite.c index 2dede5250..f97b8745e 100644 --- a/file_io/unix/readwrite.c +++ b/file_io/unix/readwrite.c @@ -393,7 +393,8 @@ APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) return rv; } -APR_DECLARE(int) apr_file_printf(apr_file_t *fptr, const char *format, ...) +APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, + const char *format, ...) { apr_status_t cc; va_list ap; diff --git a/file_io/win32/readwrite.c b/file_io/win32/readwrite.c index fa29734e7..76b6ba3dd 100644 --- a/file_io/win32/readwrite.c +++ b/file_io/win32/readwrite.c @@ -465,7 +465,8 @@ static int printf_flush(apr_vformatter_buff_t *vbuff) return -1; } -APR_DECLARE(int) apr_file_printf(apr_file_t *fptr, const char *format, ...) +APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, + const char *format, ...) { int cc; va_list ap; diff --git a/include/apr_file_io.h b/include/apr_file_io.h index b1775b459..63da4497e 100644 --- a/include/apr_file_io.h +++ b/include/apr_file_io.h @@ -566,7 +566,8 @@ APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data, * @param ... The values to substitute in the format string * @return The number of bytes written */ -APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, const char *format, ...) +APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, + const char *format, ...) __attribute__((format(printf,2,3))); /** diff --git a/include/apr_tables.h b/include/apr_tables.h index 6f0584867..8d10e4933 100644 --- a/include/apr_tables.h +++ b/include/apr_tables.h @@ -349,6 +349,19 @@ APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p, const apr_table_t *overlay, const apr_table_t *base); +/** + * Declaration prototype for the iterator callback function of apr_table_do() + * and apr_table_vdo(). + * @param rec The data passed as the first argument to apr_table_[v]do() + * @param key The key from this iteration of the table + * @param key The value from this iteration of the table + * @remark Iteration continues while this callback function returns non-zero. + * To export the callback function for apr_table_[v]do() it must be declared + * in the _NONSTD convention. + */ +typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key, + const char *value); + /** * Iterate over a table running the provided function once for every * element in the table. If there is data passed in as a vararg, then the @@ -361,8 +374,9 @@ APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p, * @param ... The vararg. If this is NULL, then all elements in the table are * run through the function, otherwise only those whose key matches * are run. + * @see apr_table_do_callback_fn_t */ -APR_DECLARE_NONSTD(void) apr_table_do(int (*comp)(void *, const char *, const char *), +APR_DECLARE_NONSTD(void) apr_table_do(apr_table_do_callback_fn_t *comp, void *rec, const apr_table_t *t, ...); /** @@ -378,7 +392,7 @@ APR_DECLARE_NONSTD(void) apr_table_do(int (*comp)(void *, const char *, const ch * table are run through the function, otherwise only those * whose key matches are run. */ -APR_DECLARE(void) apr_table_vdo(int (*comp)(void *, const char *, const char *), +APR_DECLARE(void) apr_table_vdo(apr_table_do_callback_fn_t *comp, void *rec, const apr_table_t *t, va_list); /** flag for overlap to use apr_table_setn */ diff --git a/tables/apr_tables.c b/tables/apr_tables.c index 9ed11d9c8..b143deb3a 100644 --- a/tables/apr_tables.c +++ b/tables/apr_tables.c @@ -695,16 +695,17 @@ APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p, * * So to make mod_file_cache easier to maintain, it's a good thing */ -APR_DECLARE(void) apr_table_do(int (*comp) (void *, const char *, const char *), - void *rec, const apr_table_t *t, ...) +APR_DECLARE_NONSTD(void) apr_table_do(apr_table_do_callback_fn_t *comp, + void *rec, const apr_table_t *t, ...) { va_list vp; va_start(vp, t); apr_table_vdo(comp, rec, t, vp); va_end(vp); } -APR_DECLARE(void) apr_table_vdo(int (*comp) (void *, const char *, const char *), - void *rec, const apr_table_t *t, va_list vp) + +APR_DECLARE(void) apr_table_vdo(apr_table_do_callback_fn_t *comp, + void *rec, const apr_table_t *t, va_list vp) { char *argp; apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts; |