summaryrefslogtreecommitdiff
path: root/navit/debug.c
diff options
context:
space:
mode:
authorJoseph Herlant <aerostitch@users.noreply.github.com>2018-04-26 10:12:26 -0700
committerjkoan <jkoan@users.noreply.github.com>2018-04-26 19:12:26 +0200
commit221f783ea1caaaab2f5ceadc6b0fb3e720aac3df (patch)
tree1ecf89faa1dfa550477669b05ef5c36e9864f68a /navit/debug.c
parent011bb15468b4cb626e9facecba924b04bd494d7f (diff)
downloadnavit-221f783ea1caaaab2f5ceadc6b0fb3e720aac3df.tar.gz
Fix:debug:Change line separators for dbg to work also on win* platform (#546)
* Fix:debug:Change line separators for dbg to work also on win* platform * Fix:debug:Break multiline dbg statements to use the new model * Fix:debug:Move the EOL into debug_vprintf
Diffstat (limited to 'navit/debug.c')
-rw-r--r--navit/debug.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/navit/debug.c b/navit/debug.c
index 6d1bd4c95..3fd1c5386 100644
--- a/navit/debug.c
+++ b/navit/debug.c
@@ -155,12 +155,12 @@ parse_dbg_level(struct attr *dbg_level_attr, struct attr *level_attr)
if(!strcmp(dbg_level_attr->u.str,"debug")){
return lvl_debug;
}
- dbg(lvl_error, "Invalid debug level in config: '%s'\n", dbg_level_attr->u.str);
+ dbg(lvl_error, "Invalid debug level in config: '%s'", dbg_level_attr->u.str);
} else if (level_attr) {
if (level_attr->u.num>= lvl_error &&
level_attr->u.num<= lvl_debug)
return level_attr->u.num;
- dbg(lvl_error, "Invalid debug level in config: %ld\n", level_attr->u.num);
+ dbg(lvl_error, "Invalid debug level in config: %ld", level_attr->u.num);
}
return lvl_unset;
}
@@ -308,7 +308,14 @@ debug_vprintf(dbg_level level, const char *module, const int mlen, const char *f
#if defined HAVE_API_WIN32_CE
#define vsnprintf _vsnprintf
#endif
- vsnprintf(debug_message+strlen(debug_message),4095-strlen(debug_message),fmt,ap);
+ gchar *fmt_newline;
+#ifdef HAVE_API_WIN32_BASE
+ fmt_newline = g_strconcat(fmt, "\r\n");
+#else
+ fmt_newline = g_strconcat(fmt, "\n");
+#endif
+ vsnprintf(debug_message+strlen(debug_message),4095-strlen(debug_message),fmt_newline,ap);
+ g_free(fmt_newline);
#ifdef DEBUG_WIN32_CE_MESSAGEBOX
mbstowcs(muni, debug_message, strlen(debug_message)+1);
MessageBoxW(NULL, muni, TEXT("Navit - Error"), MB_APPLMODAL|MB_OK|MB_ICONERROR);
@@ -391,7 +398,7 @@ debug_dump_mallocs(void)
{
struct malloc_head *head=malloc_heads;
int i;
- dbg(lvl_debug,"mallocs %d\n",mallocs);
+ dbg(lvl_debug,"mallocs %d",mallocs);
while (head) {
fprintf(stderr,"unfreed malloc from %s of size %d\n",head->where,head->size);
for (i = 0 ; i < 8 ; i++)
@@ -414,7 +421,7 @@ debug_malloc(const char *where, int line, const char *func, int size)
debug_malloc_size+=size;
if (debug_malloc_size/(1024*1024) != debug_malloc_size_m) {
debug_malloc_size_m=debug_malloc_size/(1024*1024);
- dbg(lvl_debug,"malloced %d kb\n",debug_malloc_size/1024);
+ dbg(lvl_debug,"malloced %d kb",debug_malloc_size/1024);
}
head=malloc(size+sizeof(*head)+sizeof(*tail));
head->magic=0xdeadbeef;