prefix.c (update_path): Replace PREFIX with KEY only when it matches a full directory name in PATH.
2004-05-15 Thomas Quinot <quinot@act-europe.fr> * prefix.c (update_path): Replace PREFIX with KEY only when it matches a full directory name in PATH. From-SVN: r81883
This commit is contained in:
parent
61f0ccffa3
commit
428d4d7660
@ -1,3 +1,8 @@
|
|||||||
|
2004-05-15 Thomas Quinot <quinot@act-europe.fr>
|
||||||
|
|
||||||
|
* prefix.c (update_path): Replace PREFIX with KEY only
|
||||||
|
when it matches a full directory name in PATH.
|
||||||
|
|
||||||
2004-05-15 Richard Earnshaw <reanrsha@arm.com>
|
2004-05-15 Richard Earnshaw <reanrsha@arm.com>
|
||||||
|
|
||||||
* arm.h (TARGET_APCS_32): Delete.
|
* arm.h (TARGET_APCS_32): Delete.
|
||||||
|
14
gcc/prefix.c
14
gcc/prefix.c
@ -238,16 +238,20 @@ tr (char *string, int c1, int c2)
|
|||||||
while (*string++);
|
while (*string++);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update PATH using KEY if PATH starts with PREFIX. The returned
|
/* Update PATH using KEY if PATH starts with PREFIX as a directory.
|
||||||
string is always malloc-ed, and the caller is responsible for
|
The returned string is always malloc-ed, and the caller is
|
||||||
freeing it. */
|
responsible for freeing it. */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
update_path (const char *path, const char *key)
|
update_path (const char *path, const char *key)
|
||||||
{
|
{
|
||||||
char *result, *p;
|
char *result, *p;
|
||||||
|
const int len = strlen (std_prefix);
|
||||||
|
|
||||||
if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
|
if (! strncmp (path, std_prefix, len)
|
||||||
|
&& (IS_DIR_SEPARATOR(path[len])
|
||||||
|
|| path[len] == '\0')
|
||||||
|
&& key != 0)
|
||||||
{
|
{
|
||||||
bool free_key = false;
|
bool free_key = false;
|
||||||
|
|
||||||
@ -257,7 +261,7 @@ update_path (const char *path, const char *key)
|
|||||||
free_key = true;
|
free_key = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = concat (key, &path[strlen (std_prefix)], NULL);
|
result = concat (key, &path[len], NULL);
|
||||||
if (free_key)
|
if (free_key)
|
||||||
free ((char *) key);
|
free ((char *) key);
|
||||||
result = translate_name (result);
|
result = translate_name (result);
|
||||||
|
Loading…
Reference in New Issue
Block a user