summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/manager.c12
-rw-r--r--src/shared/util.h5
2 files changed, 9 insertions, 8 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index a3eeb4afc1..8e66732cd7 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -226,10 +226,8 @@ static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned po
assert(pos <= width+1); /* 0 or width+1 mean that the center light is behind the corner */
if (pos > 1) {
- if (pos > 2) {
- memset(p, ' ', pos-2);
- p += pos-2;
- }
+ if (pos > 2)
+ p = mempset(p, ' ', pos-2);
p = stpcpy(p, ANSI_RED_ON);
*p++ = '*';
}
@@ -244,10 +242,8 @@ static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned po
if (pos < width) {
p = stpcpy(p, ANSI_RED_ON);
*p++ = '*';
- if (pos < width-1) {
- memset(p, ' ', width-1-pos);
- p += width-1-pos;
- }
+ if (pos < width-1)
+ p = mempset(p, ' ', width-1-pos);
p = stpcpy(p, ANSI_HIGHLIGHT_OFF);
}
}
diff --git a/src/shared/util.h b/src/shared/util.h
index 04c9fcd71e..f0dfe19ad4 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -594,3 +594,8 @@ int search_and_fopen_nulstr(const char *path, const char *mode, const char *sear
} else if (ignore_file((de)->d_name)) \
continue; \
else
+
+static inline void *mempset(void *s, int c, size_t n) {
+ memset(s, c, n);
+ return (char*)s + n;
+}