This is for parsing multiple numbers from one weston.ini key, which
means I cannot use weston_config_section_get_double(). Also going to use
float type, which has less range than double.
Ironically, the tests fill likely fail on locales that do not use
period as the radix character.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Mapping between strings and enum values is open-coded in several places.
Introduce helpers here, and use them in the next patch.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This function is useful across multiple components of the project, so
move it to a helper header.
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This is a human readable replacement for printing out the list of all
available GL extensions that doesn't happen anymore by default.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
asprintf() has the problem that it leaves *strp undefined when it
fails. Here is a simple wrapper that ensures NULL if asprintf() fails,
which is much more convenient to use.
This will be useful in future patches, where one needs to return error
messages from maybe failing functions, and more.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Adds a safe strtol helper function, modeled loosely after Wayland
scanner's strtouint. This encapsulates the various quirks of strtol
behavior, and streamlines the interface to just handling base-10 numbers
with a simple true/false error indicator and a uint32_t return by
reference.
Test cases are loosely derived from an earlier patch by Imran Zaman.
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>