[systemd-devel] [PATCH 1/4] Adding a strneq, to represent (!strncmp(a, b, n))

fidencio at profusion.mobi fidencio at profusion.mobi
Wed Oct 6 21:03:34 PDT 2010


From: Fabiano Fidencio <fidencio at profusion.mobi>

As we have streq to repesent (strcmp(a, b) == 0),I'm adding
strneq to represent (strncmp(a, b, n) == 0), that will be used
in umount.c (at least).
---
 src/util.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/util.h b/src/util.h
index f21aecf..618e7cf 100644
--- a/src/util.h
+++ b/src/util.h
@@ -82,6 +82,7 @@ usec_t timeval_load(const struct timeval *tv);
 struct timeval *timeval_store(struct timeval *tv, usec_t u);
 
 #define streq(a,b) (strcmp((a),(b)) == 0)
+#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
 
 bool streq_ptr(const char *a, const char *b);
 
-- 
1.7.3



More information about the systemd-devel mailing list