On 11.08.2015 03:09, John Ferlan wrote: > > > On 08/03/2015 02:39 AM, Michal Privoznik wrote: >> The function is used to parse a tuple delimited by commas into >> virNetDevBandwidth structure. So far only three out of fore >> fields are supported: average, peak and burst. The single missing >> field is floor. Well, the parsing works, but I think we can do >> better. Especially when we will need to parse floor too in very >> close future. >> >> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> >> --- >> tools/virsh-domain.c | 80 ++++++++++++++++++++++++++++++---------------------- >> 1 file changed, 47 insertions(+), 33 deletions(-) >> >> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c >> index a61656f..bb40ddd 100644 >> --- a/tools/virsh-domain.c >> +++ b/tools/virsh-domain.c >> @@ -865,36 +865,58 @@ static const vshCmdOptDef opts_attach_interface[] = { >> /* parse inbound and outbound which are in the format of >> * 'average,peak,burst', in which peak and burst are optional, >> * thus 'average,,burst' and 'average,peak' are also legal. */ >> -static int parseRateStr(const char *rateStr, virNetDevBandwidthRatePtr rate) >> +static int parseRateStr(vshControl *ctl, >> + const char *rateStr, >> + virNetDevBandwidthRatePtr rate) >> { >> - const char *average = NULL; >> - char *peak = NULL, *burst = NULL; >> + char *token; >> + char *next; >> + char *saveptr; > > My compiler complained about uninitialized value here especially when > used with strtok_r (setting = NULL pacifies compiler). Interesting since I want strtok_r to initialize the variable to a value. Whatever, initializing to NULL - I can live with that. > > ACK with the adjustment. > > John > Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list