[PATCH wayland] wl_strtol and wl_strtoul utility functions are added

Bill Spitzak spitzak at gmail.com
Wed Oct 15 12:48:12 PDT 2014

According the the Linux man page you have to set errno to zero to use 
strtol correctly anyway.

Quick test shows this is the only way to detect out-of-range errors. The 
glib strtol consumes all digits no matter how many you type in (rather 
than possibly quitting on the first digit that makes the number go out 
of range, which would all this to be detected by looking at the end 

It seems the only way to fix this would be to write the entire 
conversion without using strtol. That might be getting out of what 
Wayland wants to write however.

On 10/15/2014 11:42 AM, Jason Ekstrand wrote:
> I don't see how this belongs in libwayland.  Sure, we use strtol twice,
> but I don't think that warrants adding 100 lines of wrapper functions
> and test cases.
> --Jason Ekstrand
> On Wed, Oct 15, 2014 at 6:16 AM, Rémi Denis-Courmont <remi at remlab.net
> <mailto:remi at remlab.net>> wrote:
>     Le 2014-10-15 16:14, Imran Zaman a écrit :
>         Hi
>         The patch is used to replace strtol and strtoul with wl_strtol and
>         wl_strtoul with inputs and result checks.
>     I don't know where Wayland developers stand on this, but I would
>     rather the client library function calls not clobber errno to zero.
>     --
>     Rémi Denis-Courmont
>     _________________________________________________
>     wayland-devel mailing list
>     wayland-devel at lists.__freedesktop.org
>     <mailto:wayland-devel at lists.freedesktop.org>
>     http://lists.freedesktop.org/__mailman/listinfo/wayland-devel
>     <http://lists.freedesktop.org/mailman/listinfo/wayland-devel>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel

More information about the wayland-devel mailing list