Re: [PATCH] Kbuild, lto: Avoid reported warning with strtoul

From: Al Viro
Date: Fri Apr 18 2014 - 00:50:16 EST


On Fri, Apr 18, 2014 at 06:35:56AM +0200, Andi Kleen wrote:
> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> Apparently someone's C library declares strtoul with warn_unused_result.
> Cast to void to avoid the warning. Error handling is not useful here.

Umm... Since we don't give a fsck for the value, isn't that simply

char *p = strchr(s, '.');
if (p) {
size_t m = strspn(p + 1, "0123456789");
if (m > 0 && (p[m + 1] == '.' || p[m + 1] == '\0'))
*p = '\0';
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/