|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 5/5] xl: improve return and exit codes of parse related functions
On Sat, 2015-10-24 at 11:01 +0530, Harmandeep Kaur wrote:
> turning parsing related functions xl exit codes towards using the
> EXIT_[SUCCESS|FAILURE] macros, instead of instead of arbitrary
> numbers
> or libxl return codes.
>
> it doesn't include parse_config_data() which is big enough to deserve
> its
> own patch
>
> Signed-off-by: Harmandeep Kaur <write.harmandeep@xxxxxxxxx>
> libxl_bitmap *cpumap)
> static int cpurange_parse(const char *cpu, libxl_bitmap *cpumap)
> {
> char *ptr, *saveptr = NULL, *buf = strdup(cpu);
> - int rc = 0;
>
> for (ptr = strtok_r(buf, ",", &saveptr); ptr;
> ptr = strtok_r(NULL, ",", &saveptr)) {
> - rc = update_cpumap_range(ptr, cpumap);
> - if (rc)
> + if (update_cpumap_range(ptr, cpumap))
> break;
> }
> free(buf);
>
> - return rc;
> + return 0;
> }
>
Oh, and also, here: I think rc is needed, in this case, to properly
deal with the failure of update_cpumap_range(), and poperly propagate
that failure to the caller.
If you want to get rid of it, you should do something like this, inside
the loop:
if (update_cpumap_range(ptr, cpumap)) {
free(buf);
return 1;
}
Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
Attachment:
signature.asc _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |