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

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Sat, 23 Feb 2013 10:03:45 +0100

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)?
Received on Sat Feb 23 2013 - 10:03:45 CET

This archive was generated by hypermail 2.3.0 : Sat Feb 23 2013 - 10:12:07 CET