qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] inet_listen_opts: add error checking


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH] inet_listen_opts: add error checking
Date: Fri, 13 Dec 2013 10:57:12 +0100

  Hi,

> <rant>
> WHY is strtol() such a PAINFUL interface to use correctly?  And WHY
> can't qemu copy libvirt's lead of writing a SANE wrapper function, and
> then mandating that the rest of the code base use the sane wrapper
> instead of strtol()?
> </rant>

Turns out there already is one, just /me didn't know.
So, for the record and the mailing list archives:

util/cutil.c provides parse_uint() and parse_uint_full().

The first returns a pointer to the remaining bits to parse, so you can
inspect the suffix (if any).  The second errors out in case there is
trailing garbage, simliar to the libvirt wrapper in case you pass in
NULL as end_ptr.

cheers,
  Gerd





reply via email to

[Prev in Thread] Current Thread [Next in Thread]