[libvirt] [PATCH v3 4/5] util: Improve CPU frequency parsing

Andrea Bolognani abologna at redhat.com
Thu Dec 14 14:01:17 UTC 2017


On Thu, 2017-12-14 at 14:55 +0100, Bjoern Walk wrote:
> > + * Returns: 0 when the string has been parsed successfully and the CPU
> > + *          frequency has been stored in @mhz, >0 when the string has not
> 
> Maybe, >0 when the line prefix does not match exactly?

Documentation goes out of sync with reality quickly enough when
the language used is purposefully vague ;)

> > +    /* Skip the colon. If anything but a colon is found, then we're
> > +     * not looking at the right string and we should move on */
> > +    if (*str != ':')
> > +        return 1;
> > +    str++;
> 
> You could do *str++ != ':' and save one line.

I'd rather not. Lines are cheap :)

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list