From a7e5f1096f02af7bfb678b0bea8da6ccfc28cc79 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 6 May 2013 20:22:23 +0200 Subject: [PATCH] Simplify a debug code function. * src/debug.c (_gpgme_debug): Remove static space string. --- src/debug.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/debug.c b/src/debug.c index 56effa75..ca0bb21a 100644 --- a/src/debug.c +++ b/src/debug.c @@ -258,17 +258,10 @@ _gpgme_debug (int level, const char *format, ...) } #ifdef FRAME_NR { - char spaces[] = " "; - int nr_spaces = sizeof (spaces) - 1; - int nr_columns; + int indent; - nr_columns = 2 * (frame_nr - 1); - if (nr_columns > nr_spaces) - nr_columns = nr_spaces; - if (nr_columns < 0) - nr_columns = 0; - spaces[nr_columns] = '\0'; - fprintf (errfp, "%s", spaces); + indent = frame_nr > 0? (2 * (frame_nr - 1)):0; + fprintf (errfp, "%*s", indent < 40? indent : 40, ""); } #endif