From: Christoph Hohmann Date: Thu, 20 Sep 2001 15:36:43 +0000 (+0000) Subject: more portable debug_print with source filename and linenumber X-Git-Tag: Release_0_6_4claws12~133 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=4ee0ed2fc68b99304e64c5ddb8ce2822b8fc1536 more portable debug_print with source filename and linenumber more newlines after debug messages --- diff --git a/ChangeLog.claws b/ChangeLog.claws index bb6528281..3db664773 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,11 @@ +2001-09-20 [christoph] + + * src/utils.[ch] + more portable debug_print with source filename + and linenumber + * src/procmsg.c + more newlines after debug messages + 2001-09-20 [paul] * configure.in diff --git a/src/procmsg.c b/src/procmsg.c index d359c8061..250881e64 100644 --- a/src/procmsg.c +++ b/src/procmsg.c @@ -207,7 +207,7 @@ GSList *procmsg_read_cache(FolderItem *item, gboolean scan_file) setvbuf(fp, file_buf, _IOFBF, sizeof(file_buf)); g_free(cache_file); - debug_print(_("\tReading summary cache...")); + debug_print(_("\tReading summary cache...\n")); /* compare cache version */ if (fread(&ver, sizeof(ver), 1, fp) != 1 || @@ -280,7 +280,7 @@ void procmsg_set_flags(GSList *mlist, FolderItem *item) g_return_if_fail(item != NULL); g_return_if_fail(item->folder != NULL); - debug_print(_("\tMarking the messages...")); + debug_print(_("\tMarking the messages...\n")); markdir = folder_item_get_path(item); if (!is_dir_exist(markdir)) diff --git a/src/utils.c b/src/utils.c index 9c5333f48..a742ed570 100644 --- a/src/utils.c +++ b/src/utils.c @@ -2033,15 +2033,13 @@ void log_verbosity_set(gboolean verbose) log_verbosity_count--; } -void debug_print_real(const gchar *file, const guint line, const gchar *format, ...) +void debug_print_real(const gchar *format, ...) { va_list args; gchar buf[BUFFSIZE]; if (!debug_mode) return; - printf("%s:%d:", file, line); - va_start(args, format); g_vsnprintf(buf, sizeof(buf), format, args); va_end(args); diff --git a/src/utils.h b/src/utils.h index 8a2e2c429..eaeef6406 100644 --- a/src/utils.h +++ b/src/utils.h @@ -117,7 +117,9 @@ perror(func); \ } -#define debug_print(format, ...) debug_print_real(__FILE__, __LINE__, format , ##__VA_ARGS__) +#define debug_print \ + debug_print_real(__FILE__ ":%d:", __LINE__), \ + debug_print_real /* for macro expansion */ #define Str(x) #x @@ -302,7 +304,7 @@ void get_rfc822_date (gchar *buf, void set_log_file (const gchar *filename); void close_log_file (void); void log_verbosity_set (gboolean verbose); -void debug_print_real (const gchar *file, const guint line, const gchar *format, ...) G_GNUC_PRINTF(3, 4); +void debug_print_real (const gchar *format, ...) G_GNUC_PRINTF(1, 2); void log_print (const gchar *format, ...) G_GNUC_PRINTF(1, 2); void log_message (const gchar *format, ...) G_GNUC_PRINTF(1, 2); void log_warning (const gchar *format, ...) G_GNUC_PRINTF(1, 2);