This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] constify to_attach
- From: Tom Tromey <tromey at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 04 Jun 2014 11:09:44 -0600
- Subject: Re: [PATCH] constify to_attach
- Authentication-results: sourceware.org; auth=none
- References: <1400696455-29563-1-git-send-email-tromey at redhat dot com> <537D025D dot 3090207 at redhat dot com>
>>>>> "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