Commit f774f819d6d406bf859d22d447895b0bc256297a

Ran Benita 2014-10-18T13:23:53

Replace some strncmp's with memcmp Signed-off-by: Ran Benita <ran234@gmail.com>

diff --git a/src/compose/paths.c b/src/compose/paths.c
index c96d7d2..8deb1dd 100644
--- a/src/compose/paths.c
+++ b/src/compose/paths.c
@@ -115,13 +115,13 @@ resolve_name(const char *filename, enum resolve_name_direction direction,
             s++;
 
         if (direction == LEFT_TO_RIGHT) {
-            if (left_len == name_len && strncmp(left, name, left_len) == 0) {
+            if (left_len == name_len && memcmp(left, name, left_len) == 0) {
                 match = strndup(right, right_len);
                 break;
             }
         }
         else if (direction == RIGHT_TO_LEFT) {
-            if (right_len == name_len && strncmp(right, name, right_len) == 0) {
+            if (right_len == name_len && memcmp(right, name, right_len) == 0) {
                 match = strndup(left, left_len);
                 break;
             }
diff --git a/src/scanner-utils.h b/src/scanner-utils.h
index b60a100..5fdb22a 100644
--- a/src/scanner-utils.h
+++ b/src/scanner-utils.h
@@ -34,13 +34,13 @@ typedef darray(struct sval) darray_sval;
 static inline bool
 svaleq(struct sval s1, struct sval s2)
 {
-    return s1.len == s2.len && strncmp(s1.start, s2.start, s1.len) == 0;
+    return s1.len == s2.len && memcmp(s1.start, s2.start, s1.len) == 0;
 }
 
 static inline bool
 svaleq_prefix(struct sval s1, struct sval s2)
 {
-    return s1.len <= s2.len && strncmp(s1.start, s2.start, s1.len) == 0;
+    return s1.len <= s2.len && memcmp(s1.start, s2.start, s1.len) == 0;
 }
 
 struct scanner {