Skip to content
Snippets Groups Projects
Commit 5c66a1a3 authored by Iain Buclaw's avatar Iain Buclaw
Browse files

d: Use filename_ncmp instead of strncmp

gcc/d/ChangeLog:

	* d-incpath.cc (prefixed_path): Use filename_ncmp instead of strncmp.
parent f87ce014
No related branches found
No related tags found
No related merge requests found
...@@ -30,11 +30,9 @@ along with GCC; see the file COPYING3. If not see ...@@ -30,11 +30,9 @@ along with GCC; see the file COPYING3. If not see
static char * static char *
prefixed_path (const char *path, const char *iprefix) prefixed_path (const char *path, const char *iprefix)
{ {
size_t len; if (cpp_relocated () && cpp_PREFIX_len != 0)
if (cpp_relocated () && (len = cpp_PREFIX_len) != 0)
{ {
if (!strncmp (path, cpp_PREFIX, len)) if (!filename_ncmp (path, cpp_PREFIX, cpp_PREFIX_len))
{ {
static const char *relocated_prefix; static const char *relocated_prefix;
/* If this path starts with the configure-time prefix, /* If this path starts with the configure-time prefix,
...@@ -52,14 +50,14 @@ prefixed_path (const char *path, const char *iprefix) ...@@ -52,14 +50,14 @@ prefixed_path (const char *path, const char *iprefix)
free (dummy); free (dummy);
} }
return concat (relocated_prefix, path + len, NULL); return concat (relocated_prefix, path + cpp_PREFIX_len, NULL);
} }
} }
if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0) if (iprefix && cpp_GCC_INCLUDE_DIR_len != 0)
{ {
if (!strncmp (path, cpp_GCC_INCLUDE_DIR, len)) if (!filename_ncmp (path, cpp_GCC_INCLUDE_DIR, cpp_GCC_INCLUDE_DIR_len))
return concat (iprefix, path + len, NULL); return concat (iprefix, path + cpp_GCC_INCLUDE_DIR_len, NULL);
} }
return xstrdup (path); return xstrdup (path);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment