mirror of
https://github.com/systemd/systemd.git
synced 2025-03-25 18:50:18 +03:00
util: introduce streq_ptr() for comparing strings or their pointers
This commit is contained in:
parent
2e317f525f
commit
e05797fba2
13
util.c
13
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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user