diff gcc/prefix.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents a06113de4d67
children 84e7813d76e9
line wrap: on
line diff
--- a/gcc/prefix.c	Sun Aug 21 07:07:55 2011 +0900
+++ b/gcc/prefix.c	Fri Oct 27 22:46:09 2017 +0900
@@ -1,6 +1,5 @@
 /* Utility to update paths from internal to external forms.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2007  Free Software Foundation, Inc.
+   Copyright (C) 1997-2017 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -67,11 +66,11 @@
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
 #if defined(_WIN32) && defined(ENABLE_WIN32_REGISTRY)
 #include <windows.h>
 #endif
 #include "prefix.h"
+#include "common/common-target.h"
 
 static const char *std_prefix = PREFIX;
 
@@ -103,8 +102,7 @@
   if (prefix == 0)
     prefix = std_prefix;
 
-  if (temp)
-    free (temp);
+  free (temp);
 
   return prefix;
 }
@@ -158,12 +156,12 @@
     }
 
   size = 32;
-  dst = xmalloc (size);
+  dst = XNEWVEC (char, size);
 
   res = RegQueryValueExA (reg_key, key, 0, &type, (LPBYTE) dst, &size);
   if (res == ERROR_MORE_DATA && type == REG_SZ)
     {
-      dst = xrealloc (dst, size);
+      dst = XRESIZEVEC (char, dst, size);
       res = RegQueryValueExA (reg_key, key, 0, &type, (LPBYTE) dst, &size);
     }
 
@@ -251,8 +249,8 @@
   char *result, *p;
   const int len = strlen (std_prefix);
 
-  if (! strncmp (path, std_prefix, len)
-      && (IS_DIR_SEPARATOR(path[len])
+  if (! filename_ncmp (path, std_prefix, len)
+      && (IS_DIR_SEPARATOR (path[len])
           || path[len] == '\0')
       && key != 0)
     {
@@ -272,10 +270,6 @@
   else
     result = xstrdup (path);
 
-#ifndef ALWAYS_STRIP_DOTDOT
-#define ALWAYS_STRIP_DOTDOT 0
-#endif
-
   p = result;
   while (1)
     {
@@ -290,7 +284,8 @@
 	  && (p != result && IS_DIR_SEPARATOR (p[-1])))
 	{
 	  *p = 0;
-	  if (!ALWAYS_STRIP_DOTDOT && access (result, X_OK) == 0)
+	  if (!targetm_common.always_strip_dotdot
+	      && access (result, X_OK) == 0)
 	    {
 	      *p = '.';
 	      break;