mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
src: Fix boolean assignment
In a few places we use 0 and false, or 1 and true interchangeably even though the variable or return type in question is boolean. Fix those places. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
fe65e9c8b5
commit
c0a3088094
@ -1848,7 +1848,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
|
|||||||
|
|
||||||
att_datatypes = att[idx].datatype;
|
att_datatypes = att[idx].datatype;
|
||||||
|
|
||||||
while (datatype <= DATATYPE_LAST && found == 0 && rc == 0) {
|
while (datatype <= DATATYPE_LAST && !found && rc == 0) {
|
||||||
if ((att_datatypes & datatype)) {
|
if ((att_datatypes & datatype)) {
|
||||||
|
|
||||||
att_datatypes ^= datatype;
|
att_datatypes ^= datatype;
|
||||||
@ -2881,14 +2881,14 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
|
|||||||
matchShown = MATCH_NO;
|
matchShown = MATCH_NO;
|
||||||
} else if (matchShown == MATCH_YES) {
|
} else if (matchShown == MATCH_YES) {
|
||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
typeShown = 0;
|
typeShown = false;
|
||||||
matchShown = MATCH_NONE;
|
matchShown = MATCH_NONE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (matchShown == MATCH_NO) {
|
if (matchShown == MATCH_NO) {
|
||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
typeShown = 0;
|
typeShown = false;
|
||||||
matchShown = MATCH_NONE;
|
matchShown = MATCH_NONE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ bool
|
|||||||
virStoragePoolObjIsAutostart(virStoragePoolObjPtr obj)
|
virStoragePoolObjIsAutostart(virStoragePoolObjPtr obj)
|
||||||
{
|
{
|
||||||
if (!obj->configFile)
|
if (!obj->configFile)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return obj->autostart;
|
return obj->autostart;
|
||||||
}
|
}
|
||||||
|
@ -1512,7 +1512,7 @@ static int lxcStateInitialize(bool privileged,
|
|||||||
if (!(lxc_driver->config = cfg = virLXCDriverConfigNew()))
|
if (!(lxc_driver->config = cfg = virLXCDriverConfigNew()))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
cfg->log_libvirtd = 0; /* by default log to container logfile */
|
cfg->log_libvirtd = false; /* by default log to container logfile */
|
||||||
cfg->have_netns = lxcCheckNetNsSupport();
|
cfg->have_netns = lxcCheckNetNsSupport();
|
||||||
|
|
||||||
/* Call function to load lxc driver configuration information */
|
/* Call function to load lxc driver configuration information */
|
||||||
|
@ -326,7 +326,7 @@ virNWFilterSnoopIsActive(char *threadKey)
|
|||||||
void *entry;
|
void *entry;
|
||||||
|
|
||||||
if (threadKey == NULL)
|
if (threadKey == NULL)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
virNWFilterSnoopActiveLock();
|
virNWFilterSnoopActiveLock();
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ qemuAgentIOProcessLine(qemuAgentPtr agent,
|
|||||||
/* receiving garbage on first sync is regular situation */
|
/* receiving garbage on first sync is regular situation */
|
||||||
if (msg && msg->sync && msg->first) {
|
if (msg && msg->sync && msg->first) {
|
||||||
VIR_DEBUG("Received garbage on sync");
|
VIR_DEBUG("Received garbage on sync");
|
||||||
msg->finished = 1;
|
msg->finished = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ qemuAgentIOProcessLine(qemuAgentPtr agent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg->rxObject = obj;
|
msg->rxObject = obj;
|
||||||
msg->finished = 1;
|
msg->finished = true;
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
} else {
|
} else {
|
||||||
/* we are out of sync */
|
/* we are out of sync */
|
||||||
@ -627,7 +627,7 @@ qemuAgentIO(GSocket *socket G_GNUC_UNUSED,
|
|||||||
/* If IO process resulted in an error & we have a message,
|
/* If IO process resulted in an error & we have a message,
|
||||||
* then wakeup that waiter */
|
* then wakeup that waiter */
|
||||||
if (agent->msg && !agent->msg->finished) {
|
if (agent->msg && !agent->msg->finished) {
|
||||||
agent->msg->finished = 1;
|
agent->msg->finished = true;
|
||||||
virCondSignal(&agent->notify);
|
virCondSignal(&agent->notify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -751,7 +751,7 @@ qemuAgentNotifyCloseLocked(qemuAgentPtr agent)
|
|||||||
/* If there is somebody waiting for a message
|
/* If there is somebody waiting for a message
|
||||||
* wake him up. No message will arrive anyway. */
|
* wake him up. No message will arrive anyway. */
|
||||||
if (agent->msg && !agent->msg->finished) {
|
if (agent->msg && !agent->msg->finished) {
|
||||||
agent->msg->finished = 1;
|
agent->msg->finished = true;
|
||||||
virCondSignal(&agent->notify);
|
virCondSignal(&agent->notify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1209,7 +1209,7 @@ void qemuAgentNotifyEvent(qemuAgentPtr agent,
|
|||||||
agent->await_event = QEMU_AGENT_EVENT_NONE;
|
agent->await_event = QEMU_AGENT_EVENT_NONE;
|
||||||
/* somebody waiting for this event, wake him up. */
|
/* somebody waiting for this event, wake him up. */
|
||||||
if (agent->msg && !agent->msg->finished) {
|
if (agent->msg && !agent->msg->finished) {
|
||||||
agent->msg->finished = 1;
|
agent->msg->finished = true;
|
||||||
virCondSignal(&agent->notify);
|
virCondSignal(&agent->notify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -617,7 +617,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED,
|
|||||||
/* If IO process resulted in an error & we have a message,
|
/* If IO process resulted in an error & we have a message,
|
||||||
* then wakeup that waiter */
|
* then wakeup that waiter */
|
||||||
if (mon->msg && !mon->msg->finished) {
|
if (mon->msg && !mon->msg->finished) {
|
||||||
mon->msg->finished = 1;
|
mon->msg->finished = true;
|
||||||
virCondSignal(&mon->notify);
|
virCondSignal(&mon->notify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -880,7 +880,7 @@ qemuMonitorClose(qemuMonitorPtr mon)
|
|||||||
else
|
else
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
}
|
}
|
||||||
mon->msg->finished = 1;
|
mon->msg->finished = true;
|
||||||
virCondSignal(&mon->notify);
|
virCondSignal(&mon->notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -781,7 +781,7 @@ int main(int argc, char **argv) {
|
|||||||
# endif /* ! LIBVIRTD */
|
# endif /* ! LIBVIRTD */
|
||||||
#endif /* ! WITH_IP */
|
#endif /* ! WITH_IP */
|
||||||
struct daemonConfig *config;
|
struct daemonConfig *config;
|
||||||
bool privileged = geteuid() == 0 ? true : false;
|
bool privileged = geteuid() == 0;
|
||||||
bool implicit_conf = false;
|
bool implicit_conf = false;
|
||||||
char *run_dir = NULL;
|
char *run_dir = NULL;
|
||||||
mode_t old_umask;
|
mode_t old_umask;
|
||||||
|
@ -99,11 +99,11 @@ daemonConfigNew(bool privileged G_GNUC_UNUSED)
|
|||||||
|
|
||||||
#ifdef WITH_IP
|
#ifdef WITH_IP
|
||||||
# ifdef LIBVIRTD
|
# ifdef LIBVIRTD
|
||||||
data->listen_tls = 1; /* Only honoured if --listen is set */
|
data->listen_tls = true; /* Only honoured if --listen is set */
|
||||||
# else /* ! LIBVIRTD */
|
# else /* ! LIBVIRTD */
|
||||||
data->listen_tls = 0; /* Always honoured, --listen doesn't exist. */
|
data->listen_tls = false; /* Always honoured, --listen doesn't exist. */
|
||||||
# endif /* ! LIBVIRTD */
|
# endif /* ! LIBVIRTD */
|
||||||
data->listen_tcp = 0;
|
data->listen_tcp = false;
|
||||||
|
|
||||||
data->tls_port = g_strdup(LIBVIRTD_TLS_PORT);
|
data->tls_port = g_strdup(LIBVIRTD_TLS_PORT);
|
||||||
data->tcp_port = g_strdup(LIBVIRTD_TCP_PORT);
|
data->tcp_port = g_strdup(LIBVIRTD_TCP_PORT);
|
||||||
@ -146,7 +146,7 @@ daemonConfigNew(bool privileged G_GNUC_UNUSED)
|
|||||||
data->max_client_requests = 5;
|
data->max_client_requests = 5;
|
||||||
|
|
||||||
data->audit_level = 1;
|
data->audit_level = 1;
|
||||||
data->audit_logging = 0;
|
data->audit_logging = false;
|
||||||
|
|
||||||
data->keepalive_interval = 5;
|
data->keepalive_interval = 5;
|
||||||
data->keepalive_count = 5;
|
data->keepalive_count = 5;
|
||||||
|
@ -1133,7 +1133,7 @@ doRemoteOpen(virConnectPtr conn,
|
|||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
priv->tls = virNetTLSContextNewClientPath(pkipath,
|
priv->tls = virNetTLSContextNewClientPath(pkipath,
|
||||||
geteuid() != 0 ? true : false,
|
geteuid() != 0,
|
||||||
tls_priority,
|
tls_priority,
|
||||||
sanity, verify);
|
sanity, verify);
|
||||||
if (!priv->tls)
|
if (!priv->tls)
|
||||||
|
@ -1231,7 +1231,7 @@ virNetServerUpdateTlsFiles(virNetServerPtr srv)
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virNetTLSContextPtr ctxt = NULL;
|
virNetTLSContextPtr ctxt = NULL;
|
||||||
bool privileged = geteuid() == 0 ? true : false;
|
bool privileged = geteuid() == 0;
|
||||||
|
|
||||||
ctxt = virNetServerGetTLSContext(srv);
|
ctxt = virNetServerGetTLSContext(srv);
|
||||||
if (!ctxt) {
|
if (!ctxt) {
|
||||||
|
@ -1340,7 +1340,7 @@ int virNetlinkEventServiceStart(unsigned int protocol G_GNUC_UNUSED,
|
|||||||
bool virNetlinkEventServiceIsRunning(unsigned int protocol G_GNUC_UNUSED)
|
bool virNetlinkEventServiceIsRunning(unsigned int protocol G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int virNetlinkEventServiceLocalPid(unsigned int protocol G_GNUC_UNUSED)
|
int virNetlinkEventServiceLocalPid(unsigned int protocol G_GNUC_UNUSED)
|
||||||
|
@ -386,7 +386,7 @@ virTimeBackOffWait(virTimeBackOffVar *var)
|
|||||||
VIR_DEBUG("t=%llu, limit=%llu", t, var->limit_t);
|
VIR_DEBUG("t=%llu, limit=%llu", t, var->limit_t);
|
||||||
|
|
||||||
if (t > var->limit_t)
|
if (t > var->limit_t)
|
||||||
return 0; /* ends the while loop */
|
return false; /* ends the while loop */
|
||||||
|
|
||||||
/* Compute next wait time. Cap at VIR_TIME_BACKOFF_CAP
|
/* Compute next wait time. Cap at VIR_TIME_BACKOFF_CAP
|
||||||
* to avoid long useless sleeps. */
|
* to avoid long useless sleeps. */
|
||||||
@ -406,5 +406,5 @@ virTimeBackOffWait(virTimeBackOffVar *var)
|
|||||||
VIR_DEBUG("sleeping for %llu ms", next);
|
VIR_DEBUG("sleeping for %llu ms", next);
|
||||||
|
|
||||||
g_usleep(next * 1000);
|
g_usleep(next * 1000);
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ virURIParamAppend(virURIPtr uri,
|
|||||||
|
|
||||||
uri->params[uri->paramsCount].name = pname;
|
uri->params[uri->paramsCount].name = pname;
|
||||||
uri->params[uri->paramsCount].value = pvalue;
|
uri->params[uri->paramsCount].value = pvalue;
|
||||||
uri->params[uri->paramsCount].ignore = 0;
|
uri->params[uri->paramsCount].ignore = false;
|
||||||
uri->paramsCount++;
|
uri->paramsCount++;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -840,9 +840,9 @@ virVMXGetConfigBoolean(virConfPtr conf, const char *name, bool *boolean_,
|
|||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
if (STRCASEEQ(string, "true")) {
|
if (STRCASEEQ(string, "true")) {
|
||||||
*boolean_ = 1;
|
*boolean_ = true;
|
||||||
} else if (STRCASEEQ(string, "false")) {
|
} else if (STRCASEEQ(string, "false")) {
|
||||||
*boolean_ = 0;
|
*boolean_ = false;
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Config entry '%s' must represent a boolean value "
|
_("Config entry '%s' must represent a boolean value "
|
||||||
|
Loading…
Reference in New Issue
Block a user