summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-10-01 01:39:49 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-10-01 09:31:25 +0300
commit90ebf6f62007726bea619dcb5beb6e858bedfd6d (patch)
tree9e5a23c8502e56c5d120bf5090a618bd44c49388
parenta25a7e66a277c0637d6c210a1f59564ac5359863 (diff)
mtd-utils: sys_errmsg: optimize indentation
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>
-rw-r--r--include/common.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/include/common.h b/include/common.h
index 9f49f55..6684a73 100644
--- a/include/common.h
+++ b/include/common.h
@@ -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 { \