summaryrefslogtreecommitdiff
path: root/gcc/config/i386/xm-djgpp.h
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-20 06:14:53 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-20 06:14:53 +0000
commit17b80c08ecff239bdb1ab5b10ad6d98819d67791 (patch)
treea03bfc505ec1118b3947c2fbbf52975e90cc2d08 /gcc/config/i386/xm-djgpp.h
parent312866af43c7d34fa7b50f97f20058108888e844 (diff)
downloadgcc-17b80c08ecff239bdb1ab5b10ad6d98819d67791.tar.gz
* cppinit.c (init_standard_includes): The returned buffer
is already malloc-ed. * gcc.c (add_prefix): Similarly. * prefix.c (translate_name): Update to support clear buffer ownership rules. (update_path): Similarly. Be sure to free any newly allocated key. UPDATE_PATH_HOST_CANONICALIZE takes only one argument. (tr): New function. * prefix.h (update_path): Update prototype and document. * config/i386/xm-djgpp.h (UPDATE_PATH_HOST_CANONICALIZE): Clean up and update to new buffer ownership rules. * doc/gcc.texi (UPDATE_PATH_HOST_CANONICALIZE): Update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45043 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386/xm-djgpp.h')
-rw-r--r--gcc/config/i386/xm-djgpp.h38
1 files changed, 14 insertions, 24 deletions
diff --git a/gcc/config/i386/xm-djgpp.h b/gcc/config/i386/xm-djgpp.h
index c26a5cf7bc8..cad1abf64c1 100644
--- a/gcc/config/i386/xm-djgpp.h
+++ b/gcc/config/i386/xm-djgpp.h
@@ -82,27 +82,17 @@ Boston, MA 02111-1307, USA. */
md_exec_prefix = update_path (md_exec_prefix, NULL); \
} while (0)
-/* Canonicalize paths containing '/dev/env/', especially those in
- prefix.c. */
-#define UPDATE_PATH_HOST_CANONICALIZE(PATH, KEY) \
- do { \
- if (strncmp (PATH, "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
- { \
- static char *djdir; \
- static int djdir_len; \
- static char fixed_path[FILENAME_MAX + 1]; \
- char *new_path; \
- /* The default prefixes all use '/dev/env/DJDIR', so optimize \
- for this. All other uses of '/dev/env/' go through \
- libc's canonicalization function. */ \
- _fixpath (PATH, fixed_path); \
- /* _fixpath removes any trailing '/', so add it back. */ \
- strcat (fixed_path, "/"); \
- new_path = xstrdup (fixed_path); \
- PATH = new_path; \
- return PATH; \
- } \
- /* If DIR_SEPARATOR_2 isn't in PATH, nothing more need be done. */ \
- if (strchr (PATH, DIR_SEPARATOR_2) == NULL) \
- return PATH; \
- } while (0)
+/* Canonicalize paths containing '/dev/env/'; used in prefix.c.
+ _fixpath is a djgpp-specific function to canonicalize a path.
+ "/dev/env/DJDIR" evaluates to "c:/djgpp" if DJDIR is "c:/djgpp" for
+ example. It removes any trailing '/', so add it back. */
+#define UPDATE_PATH_HOST_CANONICALIZE(PATH) \
+ if (memcmp ((PATH), "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
+ { \
+ static char fixed_path[FILENAME_MAX + 1]; \
+ \
+ _fixpath ((PATH), fixed_path); \
+ strcat (fixed_path, "/"); \
+ free (PATH); \
+ (PATH) = xstrdup (fixed_path); \
+ }