Hi Current master causes build warnings when configured with --trace. It may be possible to solve this by changing the order of include statements or adding an extern declaration somewhere, but I have not found a way to do so yet.
I don't think it's very nice to have lots of implicit declaration warnings, so I suggest reverting this patch. Some quick benchmarking suggests there is a 1% drop in req/sec from doing so. > ./include/mk_iov.h: In function ‘mk_iov_add_entry’: > ./include/mk_iov.h:114:5: warning: implicit declaration of function > ‘mk_print’ [-Wimplicit-function-declaration] > In file included from mk_plugin.c:30:0: > ./include/mk_utils.h: At top level: > ./include/mk_utils.h:83:6: warning: conflicting types for ‘mk_print’ [enabled > by default] > In file included from ./include/mk_plugin.h:29:0, > from ./include/mk_utils.h:57, > from mk_plugin.c:30: > ./include/mk_iov.h:114:5: note: previous implicit declaration of ‘mk_print’ > was here -- Sonny Karlsson
>From 9d0fc9b8b012f257773de85064688482ff8ea3c8 Mon Sep 17 00:00:00 2001 From: Sonny Karlsson <[email protected]> Date: Sun, 12 Aug 2012 16:10:08 +0200 Subject: [PATCH] Revert "iov: Make iov_add_entry inline" Causes build errors when monkey is configured with --trace. This reverts commit d6472cdb785e9ad9a8b22cb6b26ddc20ace0d24d. Signed-off-by: Sonny Karlsson <[email protected]> --- src/include/mk_iov.h | 44 +++----------------------------------------- src/mk_iov.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 41 deletions(-) diff --git a/src/include/mk_iov.h b/src/include/mk_iov.h index 1c4cdab..1139723 100644 --- a/src/include/mk_iov.h +++ b/src/include/mk_iov.h @@ -23,7 +23,6 @@ #define MK_IOV_H #include <sys/uio.h> -#include "mk_utils.h" #define MK_IOV_FREE_BUF 1 #define MK_IOV_NOT_FREE_BUF 0 @@ -61,6 +60,9 @@ struct mk_iov struct mk_iov *mk_iov_create(int n, int offset); int mk_iov_realloc(struct mk_iov *mk_io, int new_size); +extern inline int mk_iov_add_entry(struct mk_iov *mk_io, char *buf, + int len, mk_pointer sep, int free); + int mk_iov_add_separator(struct mk_iov *mk_io, mk_pointer sep); ssize_t mk_iov_send(int fd, struct mk_iov *mk_io); @@ -77,44 +79,4 @@ void mk_iov_separators_init(void); void mk_iov_free_marked(struct mk_iov *mk_io); void mk_iov_print(struct mk_iov *mk_io); -static inline void _mk_iov_set_free(struct mk_iov *mk_io, char *buf) -{ - mk_io->buf_to_free[mk_io->buf_idx] = (char *) buf; - mk_io->buf_idx++; -} - -static inline int mk_iov_add_entry(struct mk_iov *mk_io, char *buf, int len, - mk_pointer sep, int free) -{ - mk_io->io[mk_io->iov_idx].iov_base = (unsigned char *) buf; - mk_io->io[mk_io->iov_idx].iov_len = len; - mk_io->iov_idx++; - mk_io->total_len += len; - -#ifdef DEBUG_IOV - if (mk_io->iov_idx > mk_io->size) { - printf("\nDEBUG IOV :: ERROR, Broken array size in:"); - printf("\n '''%s'''", buf); - fflush(stdout); - } -#endif - - /* Add separator */ - if (sep.len > 0) { - mk_io->io[mk_io->iov_idx].iov_base = sep.data; - mk_io->io[mk_io->iov_idx].iov_len = sep.len; - mk_io->iov_idx++; - mk_io->total_len += sep.len; - } - - if (free == MK_IOV_FREE_BUF) { - _mk_iov_set_free(mk_io, buf); - } - - mk_bug(mk_io->iov_idx > mk_io->size); - - return mk_io->iov_idx; -} - - #endif diff --git a/src/mk_iov.c b/src/mk_iov.c index 8b8f5cc..ccec079 100644 --- a/src/mk_iov.c +++ b/src/mk_iov.c @@ -42,6 +42,45 @@ const mk_pointer mk_iov_slash = mk_pointer_init(MK_IOV_SLASH); const mk_pointer mk_iov_none = mk_pointer_init(MK_IOV_NONE); const mk_pointer mk_iov_equal = mk_pointer_init(MK_IOV_EQUAL); +static void _mk_iov_set_free(struct mk_iov *mk_io, char *buf) +{ + mk_io->buf_to_free[mk_io->buf_idx] = (char *) buf; + mk_io->buf_idx++; +} + +int mk_iov_add_entry(struct mk_iov *mk_io, char *buf, int len, + mk_pointer sep, int free) +{ + mk_io->io[mk_io->iov_idx].iov_base = (unsigned char *) buf; + mk_io->io[mk_io->iov_idx].iov_len = len; + mk_io->iov_idx++; + mk_io->total_len += len; + +#ifdef DEBUG_IOV + if (mk_io->iov_idx > mk_io->size) { + printf("\nDEBUG IOV :: ERROR, Broken array size in:"); + printf("\n '''%s'''", buf); + fflush(stdout); + } +#endif + + /* Add separator */ + if (sep.len > 0) { + mk_io->io[mk_io->iov_idx].iov_base = sep.data; + mk_io->io[mk_io->iov_idx].iov_len = sep.len; + mk_io->iov_idx++; + mk_io->total_len += sep.len; + } + + if (free == MK_IOV_FREE_BUF) { + _mk_iov_set_free(mk_io, buf); + } + + mk_bug(mk_io->iov_idx > mk_io->size); + + return mk_io->iov_idx; +} + struct mk_iov *mk_iov_create(int n, int offset) { int i; -- 1.7.10.4
_______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
