diff --git a/src/commands.c b/src/commands.c index 644fe43b..cef51d35 100644 --- a/src/commands.c +++ b/src/commands.c @@ -121,8 +121,9 @@ set_file_variables (struct file *file, const char *stem) for (d = enter_file (strcache_add (".SUFFIXES"))->deps; d ; d = d->next) { - size_t slen = strlen (dep_name (d)); - if (len > slen && strneq (dep_name (d), name + (len - slen), slen)) + const char *dn = dep_name (d); + size_t slen = strlen (dn); + if (len > slen && memcmp (dn, name + (len - slen), slen) == 0) { file->stem = stem = strcache_add_len (name, len - slen); break; diff --git a/src/function.c b/src/function.c index 38ab9667..89449a8f 100644 --- a/src/function.c +++ b/src/function.c @@ -990,8 +990,9 @@ a_word_hash_cmp (const void *x, const void *y) int result = (int) ((struct a_word const *) x)->length - ((struct a_word const *) y)->length; if (result) return result; - return_STRING_COMPARE (((struct a_word const *) x)->str, - ((struct a_word const *) y)->str); + return_STRING_N_COMPARE (((struct a_word const *) x)->str, + ((struct a_word const *) y)->str, + ((struct a_word const *) y)->length); } struct a_pattern @@ -1110,7 +1111,7 @@ func_filter_filterout (char *o, char **argv, const char *funcname) else for (wp = words; wp < word_end; ++wp) wp->matched |= (wp->length == pp->length - && strneq (pp->str, wp->str, wp->length)); + && memcmp (pp->str, wp->str, wp->length) == 0); } /* Output the words that matched (or didn't, for filter-out). */ @@ -1245,7 +1246,7 @@ func_sort (char *o, char **argv, const char *funcname UNUSED) { len = strlen (words[i]); if (i == wordi - 1 || strlen (words[i + 1]) != len - || strcmp (words[i], words[i + 1])) + || memcmp (words[i], words[i + 1], len)) { o = variable_buffer_output (o, words[i], len); o = variable_buffer_output (o, " ", 1); diff --git a/src/main.c b/src/main.c index 9053935b..829824bb 100644 --- a/src/main.c +++ b/src/main.c @@ -1404,7 +1404,7 @@ main (int argc, char **argv, char **envp) /* If this is MAKE_RESTARTS, check to see if the "already printed the enter statement" flag is set. */ - if (len == 13 && strneq (envp[i], "MAKE_RESTARTS", 13)) + if (len == 13 && memcmp (envp[i], "MAKE_RESTARTS", 13) == 0) { if (*ep == '-') { diff --git a/src/read.c b/src/read.c index 6007273f..97e71bac 100644 --- a/src/read.c +++ b/src/read.c @@ -164,9 +164,8 @@ static char *unescape_char (char *string, int c); /* Compare a word, both length and contents. - P must point to the word to be tested, and WLEN must be the length. -*/ -#define word1eq(s) (wlen == CSTRLEN (s) && strneq (s, p, CSTRLEN (s))) + P must point to the word to be tested, and WLEN must be the length. */ +#define word1eq(s) (wlen == CSTRLEN (s) && memcmp (s, p, CSTRLEN (s)) == 0) /* Read in all the makefiles and return a chain of targets to rebuild. */