diff options
author | Andreas Färber <afaerber@suse.de> | 2016-05-22 04:34:04 +0200 |
---|---|---|
committer | Andreas Fritiofson <andreas.fritiofson@gmail.com> | 2016-07-19 10:45:16 +0100 |
commit | f19ac83152b54a204b8148815a538d868973e1e1 (patch) | |
tree | 381a04c00bd20dd508d6020f869ea3dd160de933 /src/helper/log.c | |
parent | f4496b25e3040e29b9bc78dd5bf8ac8128c09a1e (diff) |
Fix usage of timeval_ms()
First, fix the timeval_ms() implementation to not have K&R but ANSI
argument semantics by adding a missing void.
timeval_ms() returns an int64_t, not uint64_t or long long. Consistently
use int64_t for variables and PRI*64 as format string.
While at it, change a few related variables to bool for clarity.
Note that timeval_ms() may return a negative error code, but not a
single caller checks for that.
Change-Id: I27cf83e75b3e9a8913f6c43e98a281bea77aac13
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/3499
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/helper/log.c')
-rw-r--r-- | src/helper/log.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/helper/log.c b/src/helper/log.c index 50a3bd78..79cbd8ec 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -45,10 +45,10 @@ int debug_level = -1; static FILE *log_output; static struct log_callback *log_callbacks; -static long long last_time; -static long long current_time; +static int64_t last_time; +static int64_t current_time; -static long long start; +static int64_t start; static const char * const log_strings[5] = { "User : ", @@ -134,12 +134,12 @@ static void log_puts(enum log_levels level, if (strlen(string) > 0) { if (debug_level >= LOG_LVL_DEBUG) { /* print with count and time information */ - int t = (int)(timeval_ms()-start); + int64_t t = timeval_ms() - start; #ifdef _DEBUG_FREE_SPACE_ struct mallinfo info; info = mallinfo(); #endif - fprintf(log_output, "%s%d %d %s:%d %s()" + fprintf(log_output, "%s%d %" PRId64 " %s:%d %s()" #ifdef _DEBUG_FREE_SPACE_ " %d" #endif @@ -410,12 +410,12 @@ void keep_alive() if (gdb_actual_connections) LOG_WARNING("keep_alive() was not invoked in the " "1000ms timelimit. GDB alive packet not " - "sent! (%lld). Workaround: increase " + "sent! (%" PRId64 "). Workaround: increase " "\"set remotetimeout\" in GDB", current_time-last_time); else LOG_DEBUG("keep_alive() was not invoked in the " - "1000ms timelimit (%lld). This may cause " + "1000ms timelimit (%" PRId64 "). This may cause " "trouble with GDB connections.", current_time-last_time); } |