OSDN Git Service

* config/mips/iris5.h (UNALIGNED_INT_ASM_OP,
[pf3gnuchains/gcc-fork.git] / gcc / prefix.c
index 88cff94..7cb2e7b 100644 (file)
@@ -96,7 +96,7 @@ get_key_value (key)
 #endif
 
   if (prefix == 0)
-    prefix = getenv (temp = concat (key, "_ROOT", NULL_PTR));
+    prefix = getenv (temp = concat (key, "_ROOT", NULL));
 
   if (prefix == 0)
     prefix = std_prefix;
@@ -139,7 +139,7 @@ concat VPARAMS ((const char *first, ...))
       arg = va_arg (args, const char *);
     }
 
-  newstr = (char *) malloc (length + 1);
+  newstr = (char *) xmalloc (length + 1);
   va_end (args);
 
   /* Now copy the individual pieces to the result string.  */
@@ -172,7 +172,7 @@ save_string (s, len)
 {
   register char *result = xmalloc (len + 1);
 
-  bcopy (s, result, len);
+  memcpy (result, s, len);
   result[len] = 0;
   return result;
 }
@@ -211,12 +211,12 @@ lookup_key (key)
     }
 
   size = 32;
-  dst = (char *) malloc (size);
+  dst = (char *) xmalloc (size);
 
   res = RegQueryValueExA (reg_key, key, 0, &type, dst, &size);
   if (res == ERROR_MORE_DATA && type == REG_SZ)
     {
-      dst = (char *) realloc (dst, size);
+      dst = (char *) xrealloc (dst, size);
       res = RegQueryValueExA (reg_key, key, 0, &type, dst, &size);
     }
 
@@ -268,16 +268,12 @@ translate_name (name)
   if (prefix == 0)
     prefix = PREFIX;
 
-  /* Remove any trailing directory separator from what we got. First check
-     for an empty prefix.  */
-  if (prefix[0] && IS_DIR_SEPARATOR (prefix[strlen (prefix) - 1]))
-    {
-      char * temp = xstrdup (prefix);
-      temp[strlen (temp) - 1] = 0;
-      prefix = temp;
-    }
+  /* We used to strip trailing DIR_SEPARATORs here, but that can
+     sometimes yield a result with no separator when one was coded
+     and intended by the user, causing two path components to run
+     together.  */
 
-  return concat (prefix, name, NULL_PTR);
+  return concat (prefix, name, NULL);
 }
 
 /* Update PATH using KEY if PATH starts with PREFIX.  */
@@ -290,14 +286,19 @@ update_path (path, key)
   if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
     {
       if (key[0] != '$')
-       key = concat ("@", key, NULL_PTR);
+       key = concat ("@", key, NULL);
 
-      path = concat (key, &path[strlen (std_prefix)], NULL_PTR);
+      path = concat (key, &path[strlen (std_prefix)], NULL);
 
       while (path[0] == '@' || path[0] == '$')
        path = translate_name (path);
     }
 
+#ifdef UPDATE_PATH_HOST_CANONICALIZE
+/* Perform host dependant canonicalization when needed.  */
+UPDATE_PATH_HOST_CANONICALIZE (path, key);
+#endif
+
 #ifdef DIR_SEPARATOR_2
   /* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */
   if (DIR_SEPARATOR != DIR_SEPARATOR_2)