ccanlint: optimize the timeout case
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 9 Apr 2010 04:42:53 +0000 (14:12 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 9 Apr 2010 04:42:53 +0000 (14:12 +0930)
This takes my "make fastcheck" from about 57 seconds to about 43 seconds.

tools/tools.c

index 769d6aeee7b1535ad191c3c22167ccb616ed283c..5db43df08b20ed8b45139055ee42c58d463322cc 100644 (file)
@@ -145,6 +145,8 @@ char *run_command(const void *ctx, unsigned int *time_ms, const char *fmt, ...)
 
        if (!time_ms)
                time_ms = &default_time;
+       else if (*time_ms == 0)
+               return talloc_strdup(ctx, "\n== TIMED OUT ==\n");
 
        va_start(ap, fmt);
        cmd = talloc_vasprintf(ctx, fmt, ap);