Re: [hackers] [st] Added basic xterm-ish palette swap support. ||Alexander Sedov

From: Christoph Lohmann <20h_AT_r-36.net>
Date: Sat, 23 Feb 2013 21:05:57 +0100

Greetings.

On Sat, 23 Feb 2013 21:05:57 +0100 "Roberto E. Vargas Caballero" <k0ga_AT_shike2.com> wrote:
>
> Hello,
>
> > +inline int
> > +parse_int(char *s) {
> > + int x = 0;
> > + char c;
> > + while(isdigit(c = *s)) {
> > + if((INT_MAX - c + '0') / 10 >= x) {
> > + x = x * 10 + c - '0';
> > + } else
> > + return -1;
> > + s++;
> > + }
> > + if(*s != '
>
>
> Why do you want add this function instead of using atoi (or strtol if you
> want detect overflow)?

Thanks for mentioning this. I didn’t see this error.


Sincerely,

Christoph Lohmann
Received on Sat Feb 23 2013 - 21:05:57 CET

This archive was generated by hypermail 2.3.0 : Sat Feb 23 2013 - 21:12:09 CET