1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

Remove unnecessary curly brackets in rest of src/[o-u]*/

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2014-11-13 15:29:21 +01:00
parent 138c2aee01
commit 8c38594b35
12 changed files with 33 additions and 66 deletions

View File

@ -660,9 +660,8 @@ openvzWriteConfigParam(const char * conf_file, const char *param, const char *va
if (fp == NULL)
goto error;
temp_fd = open(temp_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (temp_fd == -1) {
if (temp_fd == -1)
goto error;
}
while (1) {
if (getline(&line, &line_size, fp) <= 0)

View File

@ -619,9 +619,8 @@ static int openvzDomainSuspend(virDomainPtr dom)
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
if (virRun(prog, NULL) < 0)
goto cleanup;
}
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_USER);
}
@ -658,9 +657,8 @@ static int openvzDomainResume(virDomainPtr dom)
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
if (virRun(prog, NULL) < 0)
goto cleanup;
}
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
}
@ -1113,9 +1111,8 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
openvzSetProgramSentinal(progstart, vm->def->name);
if (virRun(progstart, NULL) < 0) {
if (virRun(progstart, NULL) < 0)
goto cleanup;
}
vm->pid = strtoI(vm->def->name);
vm->def->id = vm->pid;
@ -1172,9 +1169,8 @@ openvzDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
}
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
if (virRun(prog, NULL) < 0)
goto cleanup;
}
vm->pid = strtoI(vm->def->name);
vm->def->id = vm->pid;
@ -1218,9 +1214,8 @@ openvzDomainUndefineFlags(virDomainPtr dom,
goto cleanup;
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
if (virRun(prog, NULL) < 0)
goto cleanup;
}
if (virDomainObjIsActive(vm)) {
vm->persistent = 0;
@ -1264,9 +1259,8 @@ openvzDomainSetAutostart(virDomainPtr dom, int autostart)
}
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
if (virRun(prog, NULL) < 0)
goto cleanup;
}
ret = 0;
cleanup:
@ -1357,9 +1351,8 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
str_vcpus[31] = '\0';
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
if (virRun(prog, NULL) < 0)
return -1;
}
vm->def->maxvcpus = vm->def->vcpus = nvcpus;
return 0;
@ -1719,9 +1712,8 @@ openvzDomainSetMemoryInternal(virDomainObjPtr vm,
snprintf(str_mem, sizeof(str_mem), "%llu", mem * 1024);
openvzSetProgramSentinal(prog, vm->def->name);
if (virRun(prog, NULL) < 0) {
if (virRun(prog, NULL) < 0)
goto cleanup;
}
return 0;
@ -2052,9 +2044,8 @@ openvzUpdateDevice(virDomainDefPtr vmdef,
return -1;
}
if (openvzSetDiskQuota(vmdef, fs, persist) < 0) {
if (openvzSetDiskQuota(vmdef, fs, persist) < 0)
return -1;
}
cur->space_hard_limit = fs->space_hard_limit;
cur->space_soft_limit = fs->space_soft_limit;
} else {

View File

@ -172,9 +172,8 @@ phypExec(LIBSSH2_SESSION *session, const char *cmd, int *exit_status,
}
}
if (channel == NULL) {
if (channel == NULL)
goto err;
}
while ((rc = libssh2_channel_exec(channel, cmd)) ==
LIBSSH2_ERROR_EAGAIN) {
@ -185,9 +184,8 @@ phypExec(LIBSSH2_SESSION *session, const char *cmd, int *exit_status,
}
}
if (rc != 0) {
if (rc != 0)
goto err;
}
for (;;) {
/* loop until we block */
@ -223,9 +221,8 @@ phypExec(LIBSSH2_SESSION *session, const char *cmd, int *exit_status,
}
}
if (rc == 0) {
if (rc == 0)
exitcode = libssh2_channel_get_exit_status(channel);
}
(*exit_status) = exitcode;
libssh2_channel_free(channel);
@ -731,9 +728,8 @@ phypUUIDTable_Pull(virConnectPtr conn)
do {
amount = sizeof(buffer);
if ((fileinfo.st_size - got) < amount) {
if ((fileinfo.st_size - got) < amount)
amount = fileinfo.st_size - got;
}
rc = libssh2_channel_read(channel, buffer, amount);
if (rc > 0) {
@ -849,9 +845,8 @@ phypUUIDTable_Init(virConnectPtr conn)
cleanup:
if (ret < 0 && table_created) {
for (i = 0; i < uuid_table->nlpars; i++) {
for (i = 0; i < uuid_table->nlpars; i++)
VIR_FREE(uuid_table->lpars[i]);
}
VIR_FREE(uuid_table->lpars);
}
VIR_FREE(ids);
@ -1718,18 +1713,16 @@ phypDomainAttachDevice(virDomainPtr domain, const char *xml)
domain_name = escape_specialcharacters(domain->name);
if (domain_name == NULL) {
if (domain_name == NULL)
goto cleanup;
}
if (VIR_STRDUP(def->os.type, "aix") < 0)
goto cleanup;
dev = virDomainDeviceDefParse(xml, def, phyp_driver->caps, NULL,
VIR_DOMAIN_XML_INACTIVE);
if (!dev) {
if (!dev)
goto cleanup;
}
if (!
(vios_name =

View File

@ -4069,9 +4069,8 @@ static sasl_callback_t *remoteAuthMakeCallbacks(int *credtype, int ncredtype)
sasl_callback_t *cbs;
size_t i;
int n;
if (VIR_ALLOC_N(cbs, ncredtype+1) < 0) {
if (VIR_ALLOC_N(cbs, ncredtype+1) < 0)
return NULL;
}
for (i = 0, n = 0; i < ncredtype; i++) {
int id = remoteAuthCredVir2SASL(credtype[i]);

View File

@ -160,9 +160,8 @@ static void virNetClientCallQueue(virNetClientCallPtr *head,
virNetClientCallPtr call)
{
virNetClientCallPtr tmp = *head;
while (tmp && tmp->next) {
while (tmp && tmp->next)
tmp = tmp->next;
}
if (tmp)
tmp->next = call;
else
@ -237,9 +236,8 @@ static bool virNetClientCallMatchPredicate(virNetClientCallPtr head,
{
virNetClientCallPtr tmp = head;
while (tmp) {
if (pred(tmp, opaque)) {
if (pred(tmp, opaque))
return true;
}
tmp = tmp->next;
}
return false;
@ -1535,9 +1533,8 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
/* If we have existing SASL decoded data, pretend
* the socket became readable so we consume it
*/
if (virNetSocketHasCachedData(client->sock)) {
if (virNetSocketHasCachedData(client->sock))
fds[0].revents |= POLLIN;
}
/* If wantClose flag is set, pretend there was an error on the socket
*/

View File

@ -1233,9 +1233,8 @@ void virNetServerClose(virNetServerPtr srv)
virObjectLock(srv);
for (i = 0; i < srv->nservices; i++) {
for (i = 0; i < srv->nservices; i++)
virNetServerServiceClose(srv->services[i]);
}
virObjectUnlock(srv);
}

View File

@ -496,9 +496,8 @@ virNetServerClientPtr virNetServerClientNewPostExecRestart(virJSONValuePtr objec
_("Missing privateData field in JSON state document"));
goto error;
}
if (!(client->privateData = privNew(client, child, privOpaque))) {
if (!(client->privateData = privNew(client, child, privOpaque)))
goto error;
}
client->privateDataFreeFunc = privFree;
client->privateDataPreExecRestart = privPreExecRestart;
}

View File

@ -516,7 +516,6 @@ void virNetServerServiceClose(virNetServerServicePtr svc)
if (!svc)
return;
for (i = 0; i < svc->nsocks; i++) {
for (i = 0; i < svc->nsocks; i++)
virNetSocketClose(svc->socks[i]);
}
}

View File

@ -875,9 +875,8 @@ virSecurityManagerGetNested(virSecurityManagerPtr mgr)
{
virSecurityManagerPtr* list = NULL;
if (STREQ("stack", mgr->drv->name)) {
if (STREQ("stack", mgr->drv->name))
return virSecurityStackGetNested(mgr);
}
if (VIR_ALLOC_N(list, 2) < 0)
return NULL;

View File

@ -1253,14 +1253,12 @@ main(int argc, char **argv)
/* clear the environment */
environ = NULL;
if (setenv("PATH", "/sbin:/usr/sbin", 1) != 0) {
if (setenv("PATH", "/sbin:/usr/sbin", 1) != 0)
vah_error(ctl, 1, _("could not set PATH"));
}
/* ensure the traditional IFS setting */
if (setenv("IFS", " \t\n", 1) != 0) {
if (setenv("IFS", " \t\n", 1) != 0)
vah_error(ctl, 1, _("could not set IFS"));
}
if (!(progname = strrchr(argv[0], '/')))
progname = argv[0];
@ -1291,9 +1289,8 @@ main(int argc, char **argv)
} else if (ctl->cmd == 'c' || ctl->cmd == 'r') {
char *included_files = NULL;
if (ctl->cmd == 'c' && virFileExists(profile)) {
if (ctl->cmd == 'c' && virFileExists(profile))
vah_error(ctl, 1, _("profile exists"));
}
if (ctl->append && ctl->newfile) {
if (vah_add_file(&buf, ctl->newfile, "rw") != 0)

View File

@ -172,9 +172,8 @@ umlBuildCommandLineNet(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_ETHERNET:
/* ethNNN=tuntap,tapname,macaddr,gateway */
virBufferAddLit(&buf, "tuntap,");
if (def->ifname) {
if (def->ifname)
virBufferAdd(&buf, def->ifname, -1);
}
if (def->data.ethernet.ipaddr) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("IP address not supported for ethernet interface"));
@ -215,9 +214,8 @@ umlBuildCommandLineNet(virConnectPtr conn,
}
bridge = virNetworkGetBridgeName(network);
virNetworkFree(network);
if (bridge == NULL) {
if (bridge == NULL)
goto error;
}
if (umlConnectTapDevice(conn, vm, def, bridge) < 0) {
VIR_FREE(bridge);

View File

@ -336,9 +336,8 @@ umlInotifyEvent(int watch,
dom = virDomainObjListFindByName(driver->domains, name);
if (!dom) {
if (!dom)
continue;
}
if (e.mask & IN_DELETE) {
VIR_DEBUG("Got inotify domain shutdown '%s'", name);
@ -1335,9 +1334,8 @@ static int umlGetProcessInfo(unsigned long long *cpuTime, pid_t pid)
FILE *pidinfo;
unsigned long long usertime, systime;
if (virAsprintf(&proc, "/proc/%lld/stat", (long long) pid) < 0) {
if (virAsprintf(&proc, "/proc/%lld/stat", (long long) pid) < 0)
return -1;
}
if (!(pidinfo = fopen(proc, "r"))) {
/* VM probably shut down, so fake 0 */
@ -2306,9 +2304,8 @@ static int umlDomainDetachUmlDisk(struct uml_driver *driver,
char *reply;
for (i = 0; i < vm->def->ndisks; i++) {
if (STREQ(vm->def->disks[i]->dst, dev->data.disk->dst)) {
if (STREQ(vm->def->disks[i]->dst, dev->data.disk->dst))
break;
}
}
if (i == vm->def->ndisks) {