On 12.03.2018 21:12, Daniel P. Berrangé wrote:
> From: "Daniel P. Berrange" <berra...@redhat.com>
> There are qemu_strtoNN functions for various sized integers. This adds two
> more for plain int & unsigned int types, with suitable range checking.

There is a prior art in NetBSD with strtoi(3) and strtou(3).


This is a clean room alternative for strtonum(3) with compat with some
other OSes.

The original code is in:


It uses a wrapper for regular strtol(3)-like functions and strtol_l(3).

A simpler strtoi(3) wrapper is used in dhcpcd:


It has one difference compared to new POSIX (release 2016 or so) - no
conversion at all is ECANCELED, not EINVAL. I think ECANCELED makes more
sense and is distinguishable with input base error, and should be preserved.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to