summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-06-20 22:40:10 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-06-20 23:03:58 -0400
commitfd59d9f29838c3888168554c774003e7ad6d33b0 (patch)
tree9c079a2c4fe074a98daf9267f21121f39359609c /src/shared
parent1021b21bc6f8dd522b46116e8598b17f9f93f1b7 (diff)
Add hasprefix macro to check prefixes of fixed length
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/logs-show.c2
-rw-r--r--src/shared/macro.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 40efad3273..89f67f52c0 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -438,7 +438,7 @@ static int output_export(
/* We already printed the boot id, from the data in
* the header, hence let's suppress it here */
if (length >= 9 &&
- memcmp(data, "_BOOT_ID=", 9) == 0)
+ hasprefix(data, "_BOOT_ID="))
continue;
if (!utf8_is_printable(data, length)) {
diff --git a/src/shared/macro.h b/src/shared/macro.h
index bfe03f2ae0..969329d152 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -186,6 +186,8 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
#define char_array_0(x) x[sizeof(x)-1] = 0;
+#define hasprefix(s, prefix) (memcmp(s, prefix, strlen(prefix)) == 0)
+
#define IOVEC_SET_STRING(i, s) \
do { \
struct iovec *_i = &(i); \