[libvirt] [PATCH 08/10] xenapi: Use virStrToLong_i instead of sscanf for CPU map parsing
Eric Blake
eblake at redhat.com
Wed Mar 31 16:22:37 UTC 2010
On 03/30/2010 10:20 AM, Matthias Bolte wrote:
> ---
> src/xenapi/xenapi_utils.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
> index 697ad39..790eebf 100644
> --- a/src/xenapi/xenapi_utils.c
> +++ b/src/xenapi/xenapi_utils.c
> @@ -309,7 +309,8 @@ getCpuBitMapfromString(char *mask, unsigned char *cpumap, int maplen)
> bzero(cpumap, maplen);
> num = strtok_r(mask, ",", &bp);
> while (num != NULL) {
> - if (sscanf(num, "%d", &pos) != 1)
> + num += strspn(num, " \t");
> + if (virStrToLong_i(num, NULL, 10, &pos) < 0)
No need to skip the whitespace yourself.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100331/ea7ef0c8/attachment-0001.sig>
More information about the libvir-list
mailing list