Re: [hackers] [sbase] Do not rely on `s' being incremented before taking the address of it || sin

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Thu, 10 Oct 2013 05:58:55 +0200

> Exactly, 'values of the same object' - there's only one value
> calculation, the other is taking the address.

Uhmmmm, your right, the address of the variable is not affected by the
increment :).

And my patch was also incorrect, the correct is only:

- r->max = (*s == '-') ? strtoul(++s, &s, 10) : r->min;
+ r->max = (*s == '-') ? strtoul(s + 1, &s, 10) : r->min;

strtoul modifies the value of s, so you don't need increment it. Actually
using s++ is a no sense here, because you are not going to use this new
value of s anymore, so, why storing it?


--
Roberto E. Vargas Caballero
_______________________________________________________________________
'Write programs that do one thing and do it well. Write programs to work
together. Write programs to handle text streams, because that is a
universal interface'
(Doug McIlroy)
In Other Words - Don't design like polkit or systemd
_______________________________________________________________________
Received on Thu Oct 10 2013 - 05:58:55 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 10 2013 - 06:00:31 CEST