This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] Parse hex and octal strings correctly in__strtoul_internal


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]