summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-10 04:38:14 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-10 04:38:14 +0200
commite05797fba258d7a58987cc8870fae6e34b94fe46 (patch)
tree7c1f6b70658ef2f73acaa40f8e402c463f098bc0 /util.c
parent2e317f525f1cc9f81acd15255d10a5c1c0bcd7b1 (diff)
util: introduce streq_ptr() for comparing strings or their pointers
Diffstat (limited to 'util.c')
-rw-r--r--util.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/util.c b/util.c
index b4d6eefbd2..3fe59c8ebb 100644
--- a/util.c
+++ b/util.c
@@ -42,6 +42,19 @@
#include "log.h"
#include "strv.h"
+bool streq_ptr(const char *a, const char *b) {
+
+ /* Like streq(), but tries to make sense of NULL pointers */
+
+ if (a && b)
+ return streq(a, b);
+
+ if (!a && !b)
+ return true;
+
+ return false;
+}
+
usec_t now(clockid_t clock_id) {
struct timespec ts;