[PATCH 1/2] Parse hex and octal strings correctly in __strtoul_internal

Siddhesh Poyarekar siddhesh@redhat.com
Wed Apr 25 06:16:00 GMT 2012


On Tue, 24 Apr 2012 22:52:43 -0700, Paul wrote:

> On Tue, Apr 24, 2012 at 10:27 PM, Siddhesh Poyarekar
> <siddhesh@redhat.com> wrote:
> 
> > Ugh, no I did not. Here's the right patch.
> 
> Looks good to me. Minor nits:
> 
>   while (1)
>     {
>       unsigned long int digval;
>       unsigned max_digit = (base <= 10) ? base - 1 : 9;
>       if (*nptr >= '0' && *nptr <= '0' + max_digit)
> 
> max_digit computation could be moved out of the loop, as base is
> constant after this point.
> 
> It may make sense to set max_digit when base is set (a couple lines
> earlier), and avoid extra conditionals (as in attached patch).
> 

Thanks I'll use this. So the ChangeLog will look like this:

2012-04-25  Siddhesh Poyarekar  <siddhesh@redhat.com>
	    Paul Pluzhnikov  <ppluzhnikov@google.com>

	* elf/dl-minimal.c (__strtoul_internal): Parse hexadecimal and
	octal strings correctly.

Committing this shortly.

--
Siddhesh



More information about the Libc-alpha mailing list