On Wed, Apr 23, 2014 at 02:45:21PM +0100, Zoltan Kiss wrote: > This function returns true when 's' is negative or greater than UINT_MAX. > Also, > the representation of 'int' and 'unsigned int' is implementation dependent, so > converting [INT_MAX..UINT_MAX] values with str_to_int is fragile. > Instead, we should convert straight to 'long long' and do a boundary check > before returning the converted value. > This patch also move the function to the .c file as it's not-trivial now, and > deletes the other str_to_u* functions as they are not used. > > Signed-off-by: Zoltan Kiss <zoltan.k...@citrix.com> > --- > v2: > - remove OVS_UNLIKELY and unnecessary () > - move the function to util.c as it became not-trivial > - remove the other str_to_u* functions as they are not used
Applied. I fixed up the coding style slightly: diff --git a/lib/util.c b/lib/util.c index 54065fe..1ebe22a 100644 --- a/lib/util.c +++ b/lib/util.c @@ -621,8 +621,7 @@ str_to_uint(const char *s, int base, unsigned int *u) if (!ok || ll < 0 || ll > UINT_MAX) { *u = 0; return false; - } - else { + } else { *u = ll; return true; } _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev