Re: [libvirt PATCH 3/4] virParseVersionString: rename to virStringParseVersion

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

 



On Fri, Jan 28, 2022 at 09:58:45PM +0100, Ján Tomko wrote:
> -int virParseVersionString(const char *str,
> -                          unsigned long *version,
> +int virStringParseVersion(unsigned long *version,
> +                          const char *str,
>                            bool allowMissing);

While I agree with renaming the function and moving it to
util/virstring, I think changing the order of arguments the way you
did goes against existing best practices. Compare with the following
signatures:

  int virStrToLong_i(char const *s,
                     char **end_ptr,
                     int base,
                     int *result);

  int virStringParsePort(const char *str,
                         unsigned int *port);

  int virStringParseYesNo(const char *str,
                          bool *result);

So if anything the new signature should look like

  int virStrinParseVersion(const char *str,
                           bool allowMissing,
                           unsigned long *version);

with all input arguments first and the single output argument last.

-- 
Andrea Bolognani / Red Hat / Virtualization





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux