The file and function name are printed in debug prints. --- gweb/gresolv.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/gweb/gresolv.c b/gweb/gresolv.c index 8ff8619..88e2c02 100644 --- a/gweb/gresolv.c +++ b/gweb/gresolv.c @@ -115,18 +115,26 @@ struct _GResolv { gpointer debug_data; }; -static inline void debug(GResolv *resolv, const char *format, ...) +#define debug(resolv, format, arg...) \ + _debug(resolv, __FILE__, __func__, format, ## arg) + +static void _debug(GResolv *resolv, const char *file, const char *caller, + const char *format, ...) { char str[256]; va_list ap; + int len; if (resolv->debug_func == NULL) return; va_start(ap, format); - if (vsnprintf(str, sizeof(str), format, ap) > 0) - resolv->debug_func(str, resolv->debug_data); + if ((len = snprintf(str, sizeof(str), "%s:%s() resolv %p ", + file, caller, resolv)) > 0) { + if (vsnprintf(str + len, sizeof(str) - len, format, ap) > 0) + resolv->debug_func(str, resolv->debug_data); + } va_end(ap); } -- 1.7.11.4 _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman