public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-890] d: Use filename_ncmp instead of strncmp
@ 2021-05-18 21:01 Iain Buclaw
  0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2021-05-18 21:01 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:5c66a1a30064edcd4c617ccfe54e28a08878050a

commit r12-890-g5c66a1a30064edcd4c617ccfe54e28a08878050a
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Tue May 18 22:57:23 2021 +0200

    d: Use filename_ncmp instead of strncmp
    
    gcc/d/ChangeLog:
    
            * d-incpath.cc (prefixed_path): Use filename_ncmp instead of strncmp.

Diff:
---
 gcc/d/d-incpath.cc | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/gcc/d/d-incpath.cc b/gcc/d/d-incpath.cc
index 8b7c4355a4a..d86392903e3 100644
--- a/gcc/d/d-incpath.cc
+++ b/gcc/d/d-incpath.cc
@@ -30,11 +30,9 @@ along with GCC; see the file COPYING3.  If not see
 static char *
 prefixed_path (const char *path, const char *iprefix)
 {
-  size_t len;
-
-  if (cpp_relocated () && (len = cpp_PREFIX_len) != 0)
+  if (cpp_relocated () && cpp_PREFIX_len != 0)
   {
-    if (!strncmp (path, cpp_PREFIX, len))
+    if (!filename_ncmp (path, cpp_PREFIX, cpp_PREFIX_len))
       {
 	static const char *relocated_prefix;
 	/* If this path starts with the configure-time prefix,
@@ -52,14 +50,14 @@ prefixed_path (const char *path, const char *iprefix)
 	    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))
-	return concat (iprefix, path + len, NULL);
+      if (!filename_ncmp (path, cpp_GCC_INCLUDE_DIR, cpp_GCC_INCLUDE_DIR_len))
+	return concat (iprefix, path + cpp_GCC_INCLUDE_DIR_len, NULL);
     }
 
   return xstrdup (path);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-18 21:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 21:01 [gcc r12-890] d: Use filename_ncmp instead of strncmp Iain Buclaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).