public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Andreas Schwab <schwab@suse.de>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] Fix undefined behaviour inconsistent for strtok
Date: Tue, 25 Oct 2016 13:13:00 -0000	[thread overview]
Message-ID: <1c969961-5ce7-8b73-bede-647263423d01@linaro.org> (raw)
In-Reply-To: <mvmoa28k2mn.fsf@hawking.suse.de>



On 25/10/2016 10:57, Andreas Schwab wrote:
> On Okt 25 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> 
>> On 25/10/2016 09:31, Andreas Schwab wrote:
>>> On Okt 25 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
>>>
>>>> 	* string/strtok.c (strtok): Return null is previous input is also
>>>
>>> s/is/if/
>>>
>>>> diff --git a/string/strtok.c b/string/strtok.c
>>>> index 7a4574d..5c4b309 100644
>>>> --- a/string/strtok.c
>>>> +++ b/string/strtok.c
>>>> @@ -40,8 +40,8 @@ STRTOK (char *s, const char *delim)
>>>>  {
>>>>    char *token;
>>>>  
>>>> -  if (s == NULL)
>>>> -    s = olds;
>>>> +  if ((s == NULL) && ((s = olds) == NULL))
>>>
>>> Please avoid assignment in an expression.  And the parens are redundant.
>>>
>>> Andreas.
>>>
>>
>> Right, with these fixes would it be acceptable?
> 
> I don't see much point in supporting invalid use of strtok.
> 
> Andreas.
> 

My point is just to add portability and align with other current
implementations. 

  reply	other threads:[~2016-10-25 13:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 10:58 Adhemerval Zanella
2016-10-25 11:31 ` Andreas Schwab
2016-10-25 12:33   ` Adhemerval Zanella
2016-10-25 12:57     ` Andreas Schwab
2016-10-25 13:13       ` Adhemerval Zanella [this message]
2016-10-25 13:20         ` Andreas Schwab
2016-10-25 13:23           ` Adhemerval Zanella
2016-10-25 13:45             ` Andreas Schwab
2016-10-25 13:49               ` Adhemerval Zanella
2016-10-25 13:51             ` Joseph Myers
2016-10-25 14:08               ` Adhemerval Zanella
2016-10-25 13:32 ` Florian Weimer
2016-10-25 14:04 Wilco Dijkstra
2016-10-25 16:46 ` Wilco Dijkstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c969961-5ce7-8b73-bede-647263423d01@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).