]> www.infradead.org Git - mtd-utils.git/commitdiff
mtd-utils: sys_errmsg: optimize indentation
authorMike Frysinger <vapier@gentoo.org>
Fri, 1 Oct 2010 05:39:49 +0000 (01:39 -0400)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 1 Oct 2010 06:31:25 +0000 (09:31 +0300)
Rather than do a for loop and output 1 space at a time, let the printf
code take care of indenting the string based on the constant length.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
include/common.h

index 9f49f5554f27baeac4edaff71a0e8211fcf8074f..6684a737b8d9d99c97be41c8cb3326268f6f7869 100644 (file)
@@ -65,11 +65,9 @@ extern "C" {
 /* System error messages */
 #define sys_errmsg(fmt, ...)  ({                                            \
        int _err = errno;                                                   \
-       size_t _i;                                                          \
        errmsg(fmt, ##__VA_ARGS__);                                         \
-       for (_i = 0; _i < sizeof(PROGRAM_NAME) + 1; _i++)                   \
-               fprintf(stderr, " ");                                       \
-       fprintf(stderr, "error %d (%s)\n", _err, strerror(_err));           \
+       fprintf(stderr, "%*serror %d (%s)\n", (int)sizeof(PROGRAM_NAME) + 1,\
+               "", _err, strerror(_err));                                  \
        -1;                                                                 \
 })
 #define sys_errmsg_die(fmt, ...) do {                                       \