This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: src/winsup/cygwin ChangeLog dcrt0.cc


On 2012-01-27 10:28, corinna@cygwin.com wrote:
CVSROOT:	/cvs/src
Module name:	src
Changes by:	corinna@sourceware.org	2012-01-27 09:28:38

Modified files:
	winsup/cygwin  : ChangeLog dcrt0.cc

Log message:
	* dcrt0.cc (is_dos_path): New macro to recognize drive letter and
UNC
	DOS paths.
	(globify): Call is_dos_path instead of isdrive.

Patches:

http://sourceware.org/cgi-bin/cvsweb.cgi/src/winsup/cygwin/ChangeLog.diff?cvsroot=src&r1=1.5666&r2=1.5667

http://sourceware.org/cgi-bin/cvsweb.cgi/src/winsup/cygwin/dcrt0.cc.diff?cvsroot=src&r1=1.422&r2=1.423

--- src/winsup/cygwin/dcrt0.cc	2011/12/21 17:19:48	1.422
+++ src/winsup/cygwin/dcrt0.cc	2012/01/27 09:28:38	1.423
@@ -194,6 +194,14 @@
 /* Perform a glob on word if it contains wildcard characters.
    Also quote every character between quotes to force glob to
    treat the characters literally. */
+
+/* Either X:[...] or \\server\[...] */
+#define is_dos_path(s) (isdrive(s) \
+			|| ((s)[0] == '\\' \
+			    && (s)[1] == '\\' \
+			    && isalpha ((s)[2]) \
+			    && strchr ((s) + 3, '\\')))
Is it safe to access 2nd, 3rd and 4th characters of the word without checking the length first?

Also, why a macro and not an inline function instead?

--
VZ



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]