delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/01/27/05:47:12

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.6 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-Spam-Score: -0.6
To: <cygwin AT cygwin DOT com>
Subject: Re: src/winsup/cygwin ChangeLog dcrt0.cc
MIME-Version: 1.0
Date: Fri, 27 Jan 2012 11:46:46 +0100
From: =?UTF-8?Q?V=C3=A1clav_Zeman?= <v DOT haisman AT sh DOT cvut DOT cz>
Message-ID: <25fbed8bb03f1d4ebf8de99b8be8bfbf@shell.sh.cvut.cz>
X-Sender: v DOT haisman AT sh DOT cvut DOT cz
User-Agent: Roundcube Webmail/0.7.1
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 2012-01-27 10:28, corinna AT cygwin DOT com wrote:
> CVSROOT:	/cvs/src
> Module name:	src
> Changes by:	corinna AT sourceware DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019