ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2011/10/17/16:25:49

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Date: Mon, 17 Oct 2011 22:24:32 +0200
From: Eli Zaretskii <eliz AT gnu DOT org>
Subject: Re: I need strtok_r() function
In-reply-to: <3533b2fa-8962-47c1-a6a8-373cc0e8a1f3@g7g2000vbv.googlegroups.com>
To: djgpp AT delorie DOT com
Message-id: <83zkgzv01r.fsf@gnu.org>
MIME-version: 1.0
X-012-Sender: halo1 AT inter DOT net DOT il
References: <bf04ff58-89d4-46fe-aaf4-ad5a07eaf8ff AT k35g2000yqh DOT googlegroups DOT com> <8339erwjdk DOT fsf AT gnu DOT org> <3533b2fa-8962-47c1-a6a8-373cc0e8a1f3 AT g7g2000vbv DOT googlegroups DOT com>
X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by delorie.com id p9HKPgxM004538
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: RayeR <glaux AT centrum DOT cz>
> Date: Mon, 17 Oct 2011 12:39:00 -0700 (PDT)
> 
> > Just use strtok.  There are no reentrancy issues with DJGPP, since
> > it's all single-threaded.
> 
> OK, but
> char *strtok(char *_s1, const char *_s2);
> has only 2 arguments. The 3rd argument is described:
> s3 is a value-return parameter used by strtok_r() to record its
> progress through s1.
> 
> I'm not sure if I could safely delete s3 in function call.

Yes, you can.  s3 is set by strtok_r and used only by it.  strtok
doesn't need this argument, because it keeps track of its progress
internally.

If you want less source level changes, you can define a macro,
something like (untested):

  #define strtok_r(s1,s2,s3)  strtok(s1,s2)


- Raw text -


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