qemu-e2k/include
Eduardo Habkost e3f9fe2d40 cutils: unsigned int parsing functions
There are lots of duplicate parsing code using strto*() in QEMU, and
most of that code is broken in one way or another. Even the visitors
code have duplicate integer parsing code[1]. This introduces functions
to help parsing unsigned int values: parse_uint() and parse_uint_full().

Parsing functions for signed ints and floats will be submitted later.

parse_uint_full() has all the checks made by opts_type_uint64() at
opts-visitor.c:

 - Check for NULL (returns -EINVAL)
 - Check for negative numbers (returns -EINVAL)
 - Check for empty string (returns -EINVAL)
 - Check for overflow or other errno values set by strtoll() (returns
   -errno)
 - Check for end of string (reject invalid characters after number)
   (returns -EINVAL)

parse_uint() does everything above except checking for the end of the
string, so callers can continue parsing the remainder of string after
the number.

Unit tests included.

[1] string-input-visitor.c:parse_int() could use the same parsing code
    used by opts-visitor.c:opts_type_int(), instead of duplicating that
    logic.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-02-04 14:38:33 -06:00
..
block vmdk: Allow selecting SCSI adapter in image creation 2013-02-01 14:58:28 +01:00
bt softmmu: move remaining include files to include/ subdirectories 2012-12-19 08:32:46 +01:00
char chardev: fix QemuOpts lifecycle 2013-01-16 06:58:53 +01:00
disas build: kill libdis, move disassemblers to disas/ 2012-12-19 08:29:06 +01:00
exec tci: Fix broken build (regression) 2013-01-19 20:01:57 +00:00
fpu softfloat: Implement uint64_to_float128 2013-01-05 10:12:50 +00:00
migration migration: move beginning stage to the migration thread 2013-01-17 13:54:18 +01:00
monitor monitor: move include files to include/monitor/ 2012-12-19 08:31:32 +01:00
net tap: multiqueue support 2013-02-01 11:03:02 -06:00
qapi misc: move include files to include/qemu/ 2012-12-19 08:32:39 +01:00
qemu bitops: unify bitops_ffsl with the one in host-utils.h, call it bitops_ctzl 2013-02-02 20:16:00 +00:00
qom qom: remove object_delete 2013-02-01 15:53:11 -06:00
sysemu util: Fix compilation of envlist.c for MinGW 2013-02-02 20:13:19 +00:00
ui qemu-pixman.h: Avoid mutual inclusion loop with console.h 2013-01-30 11:16:28 +01:00
config.h janitor: move remaining public headers to include/ 2012-12-19 08:32:46 +01:00
elf.h janitor: move remaining public headers to include/ 2012-12-19 08:32:46 +01:00
libfdt_env.h fdt: Use bswapN instead of bswap_N 2013-01-12 12:22:58 +00:00
qemu-common.h cutils: unsigned int parsing functions 2013-02-04 14:38:33 -06:00
trace.h build: some simplifications for "trace/Makefile.objs" 2013-01-12 18:42:51 +01:00