atom: replace an avoidable strlen
authorRan Benita <ran@unusedvar.com>
Fri, 8 Nov 2019 22:20:45 +0000 (00:20 +0200)
committerRan Benita <ran@unusedvar.com>
Fri, 8 Nov 2019 22:20:45 +0000 (00:20 +0200)
Signed-off-by: Ran Benita <ran@unusedvar.com>
src/atom.c

index fd05fb8..2b5b3ed 100644 (file)
@@ -148,7 +148,7 @@ find_atom_pointer(struct atom_table *table, const char *string, size_t len,
         else {
             /* Now start testing the strings. */
             const int cmp = strncmp(string, node->string, len);
-            if (cmp < 0 || (cmp == 0 && len < strlen(node->string))) {
+            if (cmp < 0 || (cmp == 0 && node->string[len] != '\0')) {
                 atomp = &node->left;
             }
             else if (cmp > 0) {