From 599347b970dec2ad471021b8eecca62e8f0854e9 Mon Sep 17 00:00:00 2001 From: navarro Date: Mon, 26 Mar 2012 17:30:03 +0200 Subject: [PATCH 1/1] This commit breaks the simgrid-java execution; Revert "Avoid unnecessary loop." This reverts commit cc4648fab8081d9a69a366d34c82295849c556ba. --- src/xbt/log.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/xbt/log.c b/src/xbt/log.c index 0e78015267..23c908ba4a 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -547,7 +547,7 @@ void xbt_log_init(int *argc, char **argv) // _XBT_LOGV(log).threshold = xbt_log_priority_debug; /* uncomment to set the LOG category to debug directly */ /* Set logs and init log submodule */ - for (j = i = 1; i < *argc; i++) { + for (i = 1; i < *argc; i++) { if (!strncmp(argv[i], "--log=", strlen("--log=")) || !strncmp(argv[i], "--gras-log=", strlen("--gras-log=")) || !strncmp(argv[i], "--surf-log=", strlen("--surf-log=")) || @@ -564,12 +564,17 @@ void xbt_log_init(int *argc, char **argv) opt++; xbt_log_control_set(opt); XBT_DEBUG("Did apply '%s' as log setting", opt); - } else { - argv[j++] = argv[i]; + /*remove this from argv */ + + for (j = i + 1; j < *argc; j++) { + argv[j - 1] = argv[j]; + } + + argv[j - 1] = NULL; + (*argc)--; + i--; /* compensate effect of next loop incrementation */ } } - argv[j] = NULL; - *argc = j; } static void log_cat_exit(xbt_log_category_t cat) -- 2.20.1