JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
Make DPRINTF and DNPRINTF obey 80 col while improving readability.
authorReginald Kennedy <rk@rejii.com>
Sat, 14 Jul 2012 20:35:15 +0000 (04:35 +0800)
committerReginald Kennedy <rk@rejii.com>
Fri, 20 Jul 2012 21:59:29 +0000 (05:59 +0800)
Debug time is now seconds since start.

spectrwm.c

index dff8f8d..5025482 100644 (file)
@@ -156,8 +156,16 @@ static const char  *buildstr = SPECTRWM_VERSION;
 
 #define SWM_DEBUG
 #ifdef SWM_DEBUG
-#define DPRINTF(x...)          do { if (swm_debug) fprintf(stderr, x); } while (0)
-#define DNPRINTF(n,x...)       do { if (swm_debug & n) { fprintf(stderr, "%ld ", (long)time(NULL)); fprintf(stderr, x); } } while (0)
+#define DPRINTF(x...) do {                                                     \
+       if (swm_debug)                                                          \
+               fprintf(stderr, x);                                             \
+} while (0)
+#define DNPRINTF(n,x...) do {                                                  \
+       if (swm_debug & n) {                                                    \
+               fprintf(stderr, "%ld ", (long)(time(NULL) - time_started));     \
+               fprintf(stderr, x);                                             \
+       }                                                                       \
+} while (0)
 #define SWM_D_MISC             0x0001
 #define SWM_D_EVENT            0x0002
 #define SWM_D_WS               0x0004
@@ -343,6 +351,7 @@ int                 spawn_position = SWM_STACK_TOP;
 int                    disable_border = 0;
 int                    border_width = 1;
 int                    verbose_layout = 0;
+time_t                 time_started;
 pid_t                  bar_pid;
 XFontSet               bar_fs;
 XFontSetExtents                *bar_fs_extents;
@@ -7603,6 +7612,8 @@ main(int argc, char *argv[])
        struct sigaction        sact;
        xcb_generic_event_t     *evt;
 
+       time_started = time(NULL);
+
        start_argv = argv;
        warnx("Welcome to spectrwm V%s Build: %s", SPECTRWM_VERSION, buildstr);
        if (!setlocale(LC_CTYPE, "") || !setlocale(LC_TIME, "") ||