diff options
Diffstat (limited to 'gcc/file-find.c')
-rw-r--r-- | gcc/file-find.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/file-find.c b/gcc/file-find.c index 87d486d..be608b2 100644 --- a/gcc/file-find.c +++ b/gcc/file-find.c @@ -105,15 +105,16 @@ find_a_file (struct path_prefix *pprefix, const char *name, int mode) return 0; } -/* Add an entry for PREFIX to prefix list PPREFIX. */ +/* Add an entry for PREFIX to prefix list PREFIX. + Add at beginning if FIRST is true. */ void -add_prefix (struct path_prefix *pprefix, const char *prefix) +do_add_prefix (struct path_prefix *pprefix, const char *prefix, bool first) { struct prefix_list *pl, **prev; int len; - if (pprefix->plist) + if (pprefix->plist && !first) { for (pl = pprefix->plist; pl->next; pl = pl->next) ; @@ -138,6 +139,22 @@ add_prefix (struct path_prefix *pprefix, const char *prefix) *prev = pl; } +/* Add an entry for PREFIX at the end of prefix list PREFIX. */ + +void +add_prefix (struct path_prefix *pprefix, const char *prefix) +{ + do_add_prefix (pprefix, prefix, false); +} + +/* Add an entry for PREFIX at the begin of prefix list PREFIX. */ + +void +add_prefix_begin (struct path_prefix *pprefix, const char *prefix) +{ + do_add_prefix (pprefix, prefix, true); +} + /* Take the value of the environment variable ENV, break it into a path, and add of the entries to PPREFIX. */ |