Re: svn commit: r254600 - head/lib/libutil

2013-08-29 Thread Bruce Evans
On Thu, 29 Aug 2013, Sergey Kandaurov wrote: On 22 August 2013 14:51, Bruce Evans wrote: expand_number() remains a very badly designed and implemented function. Its design errors start with its name. It doesn't expand numbers. It ... [...] Some of the other bugs in the old version: % /*

Re: svn commit: r254600 - head/lib/libutil

2013-08-29 Thread Sergey Kandaurov
On 22 August 2013 14:51, Bruce Evans wrote: > On Wed, 21 Aug 2013, Jilles Tjoelker wrote: > >> On Thu, Aug 22, 2013 at 01:24:13AM +0400, Sergey Kandaurov wrote: >>> >>> On Wed, Aug 21, 2013 at 10:27:25PM +0200, Jilles Tjoelker wrote: On Wed, Aug 21, 2013 at 11:03:10PM +0400, Sergey Kanda

Re: svn commit: r254600 - head/lib/libutil

2013-08-22 Thread Bruce Evans
On Wed, 21 Aug 2013, Jilles Tjoelker wrote: On Thu, Aug 22, 2013 at 01:24:13AM +0400, Sergey Kandaurov wrote: On Wed, Aug 21, 2013 at 10:27:25PM +0200, Jilles Tjoelker wrote: On Wed, Aug 21, 2013 at 11:03:10PM +0400, Sergey Kandaurov wrote: On Wed, Aug 21, 2013 at 09:21:47PM +0400, Andrey Che

Re: svn commit: r254600 - head/lib/libutil

2013-08-22 Thread Andrey Chernov
On 22.08.2013 14:01, Andrey Chernov wrote: > On 22.08.2013 1:37, Jilles Tjoelker wrote: >>> if (number == UINTMAX_MAX && errno == ERANGE) { >>> return (-1); >>> } >>> >>> + if (errno == 0) >>> + errno = saved_errno; >>> + >> This looks good to m

Re: svn commit: r254600 - head/lib/libutil

2013-08-22 Thread Andrey Chernov
On 22.08.2013 1:37, Jilles Tjoelker wrote: >> if (number == UINTMAX_MAX && errno == ERANGE) { >> return (-1); >> } >> >> + if (errno == 0) >> + errno = saved_errno; >> + > This looks good to me. > Just being nitpicking) number == UINTMAX_MAX c

Re: svn commit: r254600 - head/lib/libutil

2013-08-21 Thread Jilles Tjoelker
On Thu, Aug 22, 2013 at 01:24:13AM +0400, Sergey Kandaurov wrote: > On Wed, Aug 21, 2013 at 10:27:25PM +0200, Jilles Tjoelker wrote: > > On Wed, Aug 21, 2013 at 11:03:10PM +0400, Sergey Kandaurov wrote: > > > On Wed, Aug 21, 2013 at 09:21:47PM +0400, Andrey Chernov wrote: > > > > On 21.08.2013 20:4

Re: svn commit: r254600 - head/lib/libutil

2013-08-21 Thread Sergey Kandaurov
On Wed, Aug 21, 2013 at 10:27:25PM +0200, Jilles Tjoelker wrote: > On Wed, Aug 21, 2013 at 11:03:10PM +0400, Sergey Kandaurov wrote: > > On Wed, Aug 21, 2013 at 09:21:47PM +0400, Andrey Chernov wrote: > > > On 21.08.2013 20:46, Sergey Kandaurov wrote: > > > > number = strtoumax(buf, &endptr

Re: svn commit: r254600 - head/lib/libutil

2013-08-21 Thread Jilles Tjoelker
On Wed, Aug 21, 2013 at 11:03:10PM +0400, Sergey Kandaurov wrote: > On Wed, Aug 21, 2013 at 09:21:47PM +0400, Andrey Chernov wrote: > > On 21.08.2013 20:46, Sergey Kandaurov wrote: > > > number = strtoumax(buf, &endptr, 0); > > > > > > + if (number == UINTMAX_MAX && errno == ERANGE) { > > > +

Re: svn commit: r254600 - head/lib/libutil

2013-08-21 Thread Sergey Kandaurov
On Wed, Aug 21, 2013 at 09:21:47PM +0400, Andrey Chernov wrote: > On 21.08.2013 20:46, Sergey Kandaurov wrote: > > number = strtoumax(buf, &endptr, 0); > > > > + if (number == UINTMAX_MAX && errno == ERANGE) { > > + return (-1); > > + } > > You need to reset errno before strtou

Re: svn commit: r254600 - head/lib/libutil

2013-08-21 Thread Andrey Chernov
On 21.08.2013 20:46, Sergey Kandaurov wrote: > number = strtoumax(buf, &endptr, 0); > > + if (number == UINTMAX_MAX && errno == ERANGE) { > + return (-1); > + } You need to reset errno before strtoumax() call (errno = 0), because any of previous functions may left it as