This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: [patch] netdb.cc to use strtok_r
- From: Corinna Vinschen <cygwin-patches at cygwin dot com>
- To: cygwin-patches at cygwin dot com
- Date: Tue, 10 Dec 2002 14:30:02 +0100
- Subject: Re: [patch] netdb.cc to use strtok_r
- References: <3DF62D35.8020.1099672B@localhost>
On Tue, Dec 10, 2002 at 06:06:45PM +1300, Craig McGeachie wrote:
Content-Description: Mail message body
> 2002-12-10 Craig McGeachie <slapdau@yahoo.com.au>
>
> * netdb.cc (parse_alias_list, parse_services_line)
> (parse_protocol_line): Change strtok calls to strtok_r.
I've checked this in, but...
> N.B. This routine relies on side effects due to the nature of
> -strtok(). strtok() initially takes a char * pointing to the start of
> -a line, and then NULL to indicate continued processing. strtok() does
> +strtok_r(). strtok_r() initially takes a char * pointing to the start of
> +a line, and then NULL to indicate continued processing. strtok_r() does
> not provide a mechanism for getting pointer to the unprocessed portion
> of a line. Alias processing is done part way through a line after
> -strtok(). This routine relies on further calls to strtok(), passing
> +strtok_r(). This routine relies on further calls to strtok_r(), passing
> NULL as the first parameter, returning alias names from the line. */
...I think this comment doesn't make any sense now. strtok_r() doesn't
have side effects on the usage of other strtok() or strtok_r() calls
with different third parameter and it's usage inside of this functions
is completely encapsulated. So I think we should drop the 'N.B.' comment
now entirely.
Comment?
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.