Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] constify to_attach
Date: Wed, 04 Jun 2014 17:09:00 -0000	[thread overview]
Message-ID: <87egz4d2jr.fsf@fleche.redhat.com> (raw)
In-Reply-To: <537D025D.3090207@redhat.com> (Pedro Alves's message of "Wed, 21	May 2014 20:45:33 +0100")

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> -  dummy = args;
>> +  dummy = (char *) args;
>> pid = strtoul (args, &dummy, 0);
>> /* Some targets don't set errno on errors, grrr!  */
>> if ((pid == 0 && dummy == args) || dummy != &args[strlen (args)])

Pedro> errno would be necessary to catch overflow, but not to check whether
Pedro> the number was syntactically correct.  strtoul always sets *endptr to
Pedro> point to the address of the first invalid character (and never to NULL).

Pedro> So you could just remove the 'dummy' assignment.

Pedro> But I'll understand if you want to keep it.

I agree that the assignment is not necessary.

However, I left it since presumably it is based on some ancient, broken
strtoul where it was actually needed, and I didn't want to get into this
aspect of the code.

Pedro> The patch looks fine to me.

I'm pushing it now.

Tom


      reply	other threads:[~2014-06-04 17:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-21 18:21 Tom Tromey
2014-05-21 18:58 ` Tom Tromey
2014-05-21 21:22   ` Joel Brobecker
2014-05-21 21:36     ` Tom Tromey
2014-05-21 22:05       ` Joel Brobecker
2014-05-21 22:55         ` Tom Tromey
2014-05-21 19:45 ` Pedro Alves
2014-06-04 17:09   ` Tom Tromey [this message]

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=87egz4d2jr.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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