[libvirt] [PATCH REPOST 19/38] virlog: Make virLogReset methods use of virLog(Output|Filter)ListFree

Cole Robinson crobinso at redhat.com
Tue May 10 01:02:48 UTC 2016


On 05/04/2016 10:30 AM, Erik Skultety wrote:
> Now that methods to free logging related lists were introduced, put them to a
> use.
> ---
>  src/util/virlog.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/src/util/virlog.c b/src/util/virlog.c
> index a1f5872..7e0936c 100644
> --- a/src/util/virlog.c
> +++ b/src/util/virlog.c
> @@ -239,11 +239,8 @@ virLogSetDefaultPriority(virLogPriority priority)
>  static void
>  virLogResetFilters(void)
>  {
> -    size_t i;
> -
> -    for (i = 0; i < virLogNbFilters; i++)
> -        VIR_FREE(virLogFilters[i]->match);
> -    VIR_FREE(virLogFilters);
> +    virLogFilterListFree(virLogFilters, virLogNbFilters);
> +    virLogFilters = NULL;
>      virLogNbFilters = 0;
>      virLogFiltersSerial++;
>  }
> @@ -321,12 +318,8 @@ virLogFilterNew(const char *match,
>  static void
>  virLogResetOutputs(void)
>  {
> -    size_t i;
> -
> -    for (i = 0; i < virLogNbOutputs; i++)
> -        virLogOutputFree(virLogOutputs[i]);
> -
> -    VIR_FREE(virLogOutputs);
> +    virLogOutputListFree(virLogOutputs, virLogNbOutputs);
> +    virLogOutputs = NULL;
>      virLogNbOutputs = 0;
>  }
>  
> 

I'd rather see this patch split and combined in with the previous two patches.
Like you did for the virLogOutputFree patch. With those changes, ACK to the
previous two patches, and would be fine to push now since this is a reasonable
cleanup IMO

- Cole




More information about the libvir-list mailing list