Re: [PATCH] virstring: Unify string list function names

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

 



On Fri, 2016-11-25 at 09:28 +0100, Michal Privoznik wrote:
> We have couple of functions that operate over NULL terminated
> lits of strings. However, our naming sucks:
> 
> virStringJoin
> virStringFreeList
> virStringFreeListCount
> virStringArrayHasString
> virStringGetFirstWithPrefix
> 
> We can do better:
> 
> virStringListJoin
> virStringListFree
> virStringListFreeCount
> virStringListHasString
> virStringListGetFirstWithPrefix
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>

[...]
> @@ -227,7 +227,7 @@ virStringArrayHasString(const char **strings,
>  }
>  
>  char *
> -virStringGetFirstWithPrefix(char **strings, const char *prefix)
> +virStringListGetFirstWithPrefix(char **strings, const char *prefix)

Since you're changing the definition anyway, you can use
the chance to move the second argument to a separate line.

[...]
> @@ -37,15 +37,15 @@ char **virStringSplit(const char *string,
>                        size_t max_tokens)
>      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
>  
> -char *virStringJoin(const char **strings,
> -                    const char *delim)
> +char *virStringListJoin(const char **strings,
> +                        const char *delim)
>      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
>  
> -void virStringFreeList(char **strings);
> -void virStringFreeListCount(char **strings, size_t count);
> +void virStringListFree(char **strings);
> +void virStringListFreeCount(char **strings, size_t count);
>  
> -bool virStringArrayHasString(const char **strings, const char *needle);
> -char *virStringGetFirstWithPrefix(char **strings, const char *prefix)
> +bool virStringListHasString(const char **strings, const char *needle);
> +char *virStringListGetFirstWithPrefix(char **strings, const char *prefix)
>      ATTRIBUTE_NONNULL(2);

Same here.


I'm assuming you changed the callers in an automated fashion,
the diff looks sane from a very quick look and the code still
compiles and passes all checks.

ACK

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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