mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
virlog: Introduce virLogOutputFree
Provide a separate method to free a logging output object. This will come handy once a method to create an individual logging output object is introduced. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
51b2606fec
commit
057788c537
@ -1822,6 +1822,7 @@ virLogGetNbOutputs;
|
|||||||
virLogGetOutputs;
|
virLogGetOutputs;
|
||||||
virLogLock;
|
virLogLock;
|
||||||
virLogMessage;
|
virLogMessage;
|
||||||
|
virLogOutputFree;
|
||||||
virLogParseDefaultPriority;
|
virLogParseDefaultPriority;
|
||||||
virLogParseFilters;
|
virLogParseFilters;
|
||||||
virLogParseOutputs;
|
virLogParseOutputs;
|
||||||
|
@ -106,8 +106,6 @@ struct _virLogOutput {
|
|||||||
virLogDestination dest;
|
virLogDestination dest;
|
||||||
char *name;
|
char *name;
|
||||||
};
|
};
|
||||||
typedef struct _virLogOutput virLogOutput;
|
|
||||||
typedef virLogOutput *virLogOutputPtr;
|
|
||||||
|
|
||||||
static virLogOutputPtr *virLogOutputs;
|
static virLogOutputPtr *virLogOutputs;
|
||||||
static size_t virLogNbOutputs;
|
static size_t virLogNbOutputs;
|
||||||
@ -329,17 +327,27 @@ virLogResetOutputs(void)
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < virLogNbOutputs; i++) {
|
for (i = 0; i < virLogNbOutputs; i++)
|
||||||
if (virLogOutputs[i]->c != NULL)
|
virLogOutputFree(virLogOutputs[i]);
|
||||||
virLogOutputs[i]->c(virLogOutputs[i]->data);
|
|
||||||
VIR_FREE(virLogOutputs[i]->name);
|
|
||||||
VIR_FREE(virLogOutputs[i]);
|
|
||||||
}
|
|
||||||
VIR_FREE(virLogOutputs);
|
VIR_FREE(virLogOutputs);
|
||||||
virLogNbOutputs = 0;
|
virLogNbOutputs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
virLogOutputFree(virLogOutputPtr output)
|
||||||
|
{
|
||||||
|
if (!output)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (output->c)
|
||||||
|
output->c(output->data);
|
||||||
|
VIR_FREE(output->name);
|
||||||
|
VIR_FREE(output);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virLogDefineOutput:
|
* virLogDefineOutput:
|
||||||
* @f: the function to call to output a message
|
* @f: the function to call to output a message
|
||||||
|
@ -130,6 +130,9 @@ struct _virLogMetadata {
|
|||||||
typedef struct _virLogMetadata virLogMetadata;
|
typedef struct _virLogMetadata virLogMetadata;
|
||||||
typedef struct _virLogMetadata *virLogMetadataPtr;
|
typedef struct _virLogMetadata *virLogMetadataPtr;
|
||||||
|
|
||||||
|
typedef struct _virLogOutput virLogOutput;
|
||||||
|
typedef virLogOutput *virLogOutputPtr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virLogOutputFunc:
|
* virLogOutputFunc:
|
||||||
* @src: the source of the log message
|
* @src: the source of the log message
|
||||||
@ -187,6 +190,7 @@ int virLogDefineOutput(virLogOutputFunc f,
|
|||||||
virLogDestination dest,
|
virLogDestination dest,
|
||||||
const char *name,
|
const char *name,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
void virLogOutputFree(virLogOutputPtr output);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal logging API
|
* Internal logging API
|
||||||
|
Loading…
Reference in New Issue
Block a user