summaryrefslogtreecommitdiff
path: root/shared/systemd/src/basic/string-util.h
diff options
context:
space:
mode:
Diffstat (limited to 'shared/systemd/src/basic/string-util.h')
-rw-r--r--shared/systemd/src/basic/string-util.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/shared/systemd/src/basic/string-util.h b/shared/systemd/src/basic/string-util.h
index cefbda3577..fdd3ce7363 100644
--- a/shared/systemd/src/basic/string-util.h
+++ b/shared/systemd/src/basic/string-util.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: LGPL-2.1+ */
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
@@ -33,6 +33,12 @@ static inline bool streq_ptr(const char *a, const char *b) {
return strcmp_ptr(a, b) == 0;
}
+static inline char* strstr_ptr(const char *haystack, const char *needle) {
+ if (!haystack || !needle)
+ return NULL;
+ return strstr(haystack, needle);
+}
+
static inline const char* strempty(const char *s) {
return s ?: "";
}
@@ -53,6 +59,10 @@ static inline const char* true_false(bool b) {
return b ? "true" : "false";
}
+static inline const char* plus_minus(bool b) {
+ return b ? "+" : "-";
+}
+
static inline const char* one_zero(bool b) {
return b ? "1" : "0";
}