mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
logging: use g_new0 instead of VIR_ALLOC
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
4c6f98cea6
commit
d59b6070d7
@ -116,8 +116,7 @@ virLogDaemonNew(virLogDaemonConfigPtr config, bool privileged)
|
|||||||
virLogDaemonPtr logd;
|
virLogDaemonPtr logd;
|
||||||
virNetServerPtr srv = NULL;
|
virNetServerPtr srv = NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(logd) < 0)
|
logd = g_new0(virLogDaemon, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
g_mutex_init(&logd->lock);
|
g_mutex_init(&logd->lock);
|
||||||
|
|
||||||
@ -214,8 +213,7 @@ virLogDaemonNewPostExecRestart(virJSONValuePtr object, bool privileged,
|
|||||||
virJSONValuePtr child;
|
virJSONValuePtr child;
|
||||||
const char *serverNames[] = { "virtlogd" };
|
const char *serverNames[] = { "virtlogd" };
|
||||||
|
|
||||||
if (VIR_ALLOC(logd) < 0)
|
logd = g_new0(virLogDaemon, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
g_mutex_init(&logd->lock);
|
g_mutex_init(&logd->lock);
|
||||||
|
|
||||||
@ -330,8 +328,7 @@ virLogDaemonClientNew(virNetServerClientPtr client,
|
|||||||
unsigned long long timestamp;
|
unsigned long long timestamp;
|
||||||
bool privileged = opaque != NULL;
|
bool privileged = opaque != NULL;
|
||||||
|
|
||||||
if (VIR_ALLOC(priv) < 0)
|
priv = g_new0(virLogDaemonClient, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
g_mutex_init(&priv->lock);
|
g_mutex_init(&priv->lock);
|
||||||
|
|
||||||
|
@ -58,8 +58,7 @@ virLogDaemonConfigNew(bool privileged G_GNUC_UNUSED)
|
|||||||
{
|
{
|
||||||
virLogDaemonConfigPtr data;
|
virLogDaemonConfigPtr data;
|
||||||
|
|
||||||
if (VIR_ALLOC(data) < 0)
|
data = g_new0(virLogDaemonConfig, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
data->max_clients = 1024;
|
data->max_clients = 1024;
|
||||||
data->admin_max_clients = 5000;
|
data->admin_max_clients = 5000;
|
||||||
|
@ -221,8 +221,7 @@ virLogHandlerLogFilePostExecRestart(virLogHandlerPtr handler,
|
|||||||
const char *domuuid;
|
const char *domuuid;
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
|
|
||||||
if (VIR_ALLOC(file) < 0)
|
file = g_new0(virLogHandlerLogFile, 1);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
handler->inhibitor(true, handler->opaque);
|
handler->inhibitor(true, handler->opaque);
|
||||||
|
|
||||||
@ -389,8 +388,7 @@ virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler,
|
|||||||
if (virPipe(pipefd) < 0)
|
if (virPipe(pipefd) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (VIR_ALLOC(file) < 0)
|
file = g_new0(virLogHandlerLogFile, 1);
|
||||||
goto error;
|
|
||||||
|
|
||||||
file->watch = -1;
|
file->watch = -1;
|
||||||
file->pipefd = pipefd[0];
|
file->pipefd = pipefd[0];
|
||||||
@ -537,8 +535,7 @@ virLogHandlerDomainReadLogFile(virLogHandlerPtr handler,
|
|||||||
if (virRotatingFileReaderSeek(file, inode, offset) < 0)
|
if (virRotatingFileReaderSeek(file, inode, offset) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (VIR_ALLOC_N(data, maxlen + 1) < 0)
|
data = g_new0(char, maxlen + 1);
|
||||||
goto error;
|
|
||||||
|
|
||||||
got = virRotatingFileReaderConsume(file, data, maxlen);
|
got = virRotatingFileReaderConsume(file, data, maxlen);
|
||||||
if (got < 0)
|
if (got < 0)
|
||||||
|
@ -113,8 +113,7 @@ virLogManagerNew(bool privileged)
|
|||||||
{
|
{
|
||||||
virLogManagerPtr mgr;
|
virLogManagerPtr mgr;
|
||||||
|
|
||||||
if (VIR_ALLOC(mgr) < 0)
|
mgr = g_new0(virLogManager, 1);
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (!(mgr->client = virLogManagerConnect(privileged, &mgr->program)))
|
if (!(mgr->client = virLogManagerConnect(privileged, &mgr->program)))
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
Reference in New Issue
Block a user