mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-31 18:15:25 +00:00
virlog: Introduce virLogFilterFree
Provide a separate method to free a logging filter object. This will come handy once a method to create an individual logging filter object is introduced. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
4b48541249
commit
18c3321b8b
@ -1815,6 +1815,7 @@ virLockSpaceReleaseResourcesForOwner;
|
||||
# util/virlog.h
|
||||
virLogDefineFilter;
|
||||
virLogDefineOutput;
|
||||
virLogFilterFree;
|
||||
virLogGetDefaultPriority;
|
||||
virLogGetFilters;
|
||||
virLogGetNbFilters;
|
||||
|
@ -86,8 +86,6 @@ struct _virLogFilter {
|
||||
virLogPriority priority;
|
||||
unsigned int flags;
|
||||
};
|
||||
typedef struct _virLogFilter virLogFilter;
|
||||
typedef virLogFilter *virLogFilterPtr;
|
||||
|
||||
static int virLogFiltersSerial = 1;
|
||||
static virLogFilterPtr *virLogFilters;
|
||||
@ -243,16 +241,24 @@ virLogResetFilters(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < virLogNbFilters; i++) {
|
||||
VIR_FREE(virLogFilters[i]->match);
|
||||
VIR_FREE(virLogFilters[i]);
|
||||
}
|
||||
for (i = 0; i < virLogNbFilters; i++)
|
||||
virLogFilterFree(virLogFilters[i]);
|
||||
VIR_FREE(virLogFilters);
|
||||
virLogNbFilters = 0;
|
||||
virLogFiltersSerial++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
virLogFilterFree(virLogFilterPtr filter)
|
||||
{
|
||||
if (!filter)
|
||||
return;
|
||||
|
||||
VIR_FREE(filter->match);
|
||||
VIR_FREE(filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* virLogDefineFilter:
|
||||
* @match: the pattern to match
|
||||
|
@ -133,6 +133,9 @@ typedef struct _virLogMetadata *virLogMetadataPtr;
|
||||
typedef struct _virLogOutput virLogOutput;
|
||||
typedef virLogOutput *virLogOutputPtr;
|
||||
|
||||
typedef struct _virLogFilter virLogFilter;
|
||||
typedef virLogFilter *virLogFilterPtr;
|
||||
|
||||
/**
|
||||
* virLogOutputFunc:
|
||||
* @src: the source of the log message
|
||||
@ -192,6 +195,7 @@ int virLogDefineOutput(virLogOutputFunc f,
|
||||
unsigned int flags);
|
||||
void virLogOutputFree(virLogOutputPtr output);
|
||||
void virLogOutputListFree(virLogOutputPtr *list, int count);
|
||||
void virLogFilterFree(virLogFilterPtr filter);
|
||||
|
||||
/*
|
||||
* Internal logging API
|
||||
|
Loading…
Reference in New Issue
Block a user