From 474048c26edf5ad4fa269ab1801bf4994bf95083 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 25 Mar 2004 15:15:27 +0000 Subject: * path.cc (normalize_posix_path): Reorganize to short circuit to DOS path handling whenever a '\' is detected. * signal.cc (sigaction): Make strace output more informative. * sigproc.cc (pending_signals::add): Just index directly into signal array rather than treating the array as a heap. (pending_signals::del): Ditto. (wait_sig): Don't send signal if we already have a similar signal queued. * sigproc.h (call_signal_handler_now): Remove obsolete declaration. --- winsup/cygwin/path.cc | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'winsup/cygwin/path.cc') diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index e602c5e8e..96fa0628c 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -188,7 +188,6 @@ pathmatch (const char *path1, const char *path2) #define isslash(c) ((c) == '/') /* Normalize a POSIX path. - \'s are converted to /'s in the process. All duplicate /'s, except for 2 leading /'s, are deleted. The result is 0 for success, or an errno error value. */ @@ -200,14 +199,11 @@ normalize_posix_path (const char *src, char *dst) syscall_printf ("src %s", src); + const char *in_src = src; + char *in_dst = dst; + if (isdrive (src) || slash_unc_prefix_p (src)) - { - int err = normalize_win32_path (src, dst); - if (!err) - for (char *p = dst; (p = strchr (p, '\\')); p++) - *p = '/'; - return err; - } + goto win32_path; if (!isslash (src[0])) { @@ -247,6 +243,8 @@ normalize_posix_path (const char *src, char *dst) while (*src) { + if (*src == '\\') + goto win32_path; /* Strip runs of /'s. */ if (!isslash (*src)) *dst++ = *src++; @@ -309,6 +307,13 @@ done: debug_printf ("%s = normalize_posix_path (%s)", dst_start, src_start); return 0; + +win32_path: + int err = normalize_win32_path (in_src, in_dst); + if (!err) + for (char *p = in_dst; (p = strchr (p, '\\')); p++) + *p = '/'; + return err; } inline void -- cgit v1.2.3