diff options
author | Daniel Mack <github@zonque.org> | 2015-07-31 19:40:57 +0200 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-07-31 19:40:57 +0200 |
commit | c474a4ecfa74d90d02822d24efa310197a5c3298 (patch) | |
tree | b03788434fd764ac3fc5a8cd8edd45c1e92a223e /src/basic/util.c | |
parent | 6ba32d1c2f04f3f01cea6ba1a082028412b5c474 (diff) | |
parent | cbfa6a41317b72553433f4ebe250dd0d34bf058f (diff) |
Merge pull request #811 from namhyung/busctl-misc-v2
busctl: Misc cleanups and a fix (v2)
Diffstat (limited to 'src/basic/util.c')
-rw-r--r-- | src/basic/util.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/basic/util.c b/src/basic/util.c index 1c15fbc172..a968e2156d 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -115,17 +115,23 @@ size_t page_size(void) { return pgsz; } -bool streq_ptr(const char *a, const char *b) { - - /* Like streq(), but tries to make sense of NULL pointers */ +int strcmp_ptr(const char *a, const char *b) { + /* Like strcmp(), but tries to make sense of NULL pointers */ if (a && b) - return streq(a, b); + return strcmp(a, b); - if (!a && !b) - return true; + if (!a && b) + return -1; - return false; + if (a && !b) + return 1; + + return 0; +} + +bool streq_ptr(const char *a, const char *b) { + return strcmp_ptr(a, b) == 0; } char* endswith(const char *s, const char *postfix) { |