Signed-off-by: Martin Kletzander <mklet...@redhat.com> --- src/util/virauth.c | 12 ++++-------- src/util/virbitmap.c | 6 ++---- src/util/virbuffer.c | 3 +-- src/util/vircommand.c | 9 +++------ src/util/virconf.c | 15 +++++---------- src/util/virdbus.c | 3 +-- src/util/virdnsmasq.c | 3 +-- src/util/vireventpoll.c | 9 +++------ src/util/virfile.c | 6 ++---- src/util/virfirewall.c | 6 ++---- src/util/viriscsi.c | 9 +++------ src/util/virlockspace.c | 6 ++---- src/util/virlog.c | 3 +-- src/util/virnetdev.c | 6 ++---- src/util/virnetdevbridge.c | 3 +-- src/util/virnetdevmacvlan.c | 9 +++------ src/util/virnetdevtap.c | 6 ++---- src/util/virpci.c | 15 +++++---------- src/util/virsexpr.c | 24 ++++++++---------------- src/util/virstorageencryption.c | 3 +-- src/util/virstoragefile.c | 6 ++---- src/util/virsysinfo.c | 3 +-- src/util/virthreadpool.c | 3 +-- src/util/virutil.c | 9 +++------ src/util/virxml.c | 18 ++++++------------ 25 files changed, 65 insertions(+), 130 deletions(-)
diff --git a/src/util/virauth.c b/src/util/virauth.c index f82e546..adb093e 100644 --- a/src/util/virauth.c +++ b/src/util/virauth.c @@ -172,15 +172,13 @@ virAuthGetUsernamePath(const char *path, return NULL; } } else { - if (virAsprintf(&prompt, _("Enter username for %s"), hostname) < 0) { + if (virAsprintf(&prompt, _("Enter username for %s"), hostname) < 0) return NULL; - } } for (ncred = 0; ncred < auth->ncredtype; ncred++) { - if (auth->credtype[ncred] != VIR_CRED_AUTHNAME) { + if (auth->credtype[ncred] != VIR_CRED_AUTHNAME) continue; - } cred.type = VIR_CRED_AUTHNAME; cred.prompt = prompt; @@ -189,9 +187,8 @@ virAuthGetUsernamePath(const char *path, cred.result = NULL; cred.resultlen = 0; - if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) { + if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) VIR_FREE(cred.result); - } break; } @@ -261,9 +258,8 @@ virAuthGetPasswordPath(const char *path, cred.result = NULL; cred.resultlen = 0; - if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) { + if ((*(auth->cb))(&cred, 1, auth->cbdata) < 0) VIR_FREE(cred.result); - } break; } diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 04a2388..05c50e4 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -640,9 +640,8 @@ virBitmapNextSetBit(virBitmapPtr bitmap, ssize_t pos) bits = bitmap->map[nl] & ~((1UL << nb) - 1); - while (bits == 0 && ++nl < bitmap->map_len) { + while (bits == 0 && ++nl < bitmap->map_len) bits = bitmap->map[nl]; - } if (bits == 0) return -1; @@ -726,9 +725,8 @@ virBitmapNextClearBit(virBitmapPtr bitmap, ssize_t pos) bits = ~bitmap->map[nl] & ~((1UL << nb) - 1); - while (bits == 0 && ++nl < bitmap->map_len) { + while (bits == 0 && ++nl < bitmap->map_len) bits = ~bitmap->map[nl]; - } if (nl == bitmap->map_len - 1) { /* Ensure tail bits are ignored. */ diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c index 52ffa08..16a81e7 100644 --- a/src/util/virbuffer.c +++ b/src/util/virbuffer.c @@ -368,9 +368,8 @@ virBufferVasprintf(virBufferPtr buf, const char *format, va_list argptr) buf->content[buf->use] = 0; grow_size = (count + 1 > 1000) ? count + 1 : 1000; - if (virBufferGrow(buf, grow_size) < 0) { + if (virBufferGrow(buf, grow_size) < 0) return; - } size = buf->size - buf->use; if ((count = vsnprintf(&buf->content[buf->use], diff --git a/src/util/vircommand.c b/src/util/vircommand.c index cbe94f8..6527d85 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -558,9 +558,8 @@ virExec(virCommandPtr cmd) pid = virFork(); - if (pid < 0) { + if (pid < 0) goto cleanup; - } if (pid) { /* parent */ VIR_FORCE_CLOSE(null); @@ -3021,9 +3020,8 @@ virCommandRunNul(virCommandPtr cmd, v[i] = NULL; virCommandSetOutputFD(cmd, &fd); - if (virCommandRunAsync(cmd, NULL) < 0) { + if (virCommandRunAsync(cmd, NULL) < 0) goto cleanup; - } if ((fp = VIR_FDOPEN(fd, "r")) == NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -3050,9 +3048,8 @@ virCommandRunNul(virCommandPtr cmd, if (func(n_tok, v, data) < 0) goto cleanup; n_tok = 0; - for (i = 0; i < n_columns; i++) { + for (i = 0; i < n_columns; i++) VIR_FREE(v[i]); - } } } diff --git a/src/util/virconf.c b/src/util/virconf.c index e221fb5..0a17eff 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -502,9 +502,8 @@ virConfParseValue(virConfParserCtxtPtr ctxt) } NEXT; SKIP_BLANKS_AND_EOL; - if (CUR == ']') { + if (CUR == ']') break; - } tmp = virConfParseValue(ctxt); if (tmp == NULL) { virConfFreeList(lst); @@ -529,9 +528,8 @@ virConfParseValue(virConfParserCtxtPtr ctxt) _("numbers not allowed in VMX format")); return NULL; } - if (virConfParseLong(ctxt, &l) < 0) { + if (virConfParseLong(ctxt, &l) < 0) return NULL; - } type = VIR_CONF_LONG; } else { virConfError(ctxt, VIR_ERR_CONF_SYNTAX, _("expecting a value")); @@ -654,9 +652,8 @@ virConfParseStatement(virConfParserCtxtPtr ctxt) char *comm = NULL; SKIP_BLANKS_AND_EOL; - if (CUR == '#') { + if (CUR == '#') return virConfParseComment(ctxt); - } name = virConfParseName(ctxt); if (name == NULL) return -1; @@ -768,9 +765,8 @@ virConfReadFile(const char *filename, unsigned int flags) return NULL; } - if ((len = virFileReadAll(filename, MAX_CONFIG_FILE_SIZE, &content)) < 0) { + if ((len = virFileReadAll(filename, MAX_CONFIG_FILE_SIZE, &content)) < 0) return NULL; - } conf = virConfParse(filename, content, len, flags); @@ -888,9 +884,8 @@ virConfSetValue(virConfPtr conf, cur = conf->entries; while (cur != NULL) { - if ((cur->name != NULL) && (STREQ(cur->name, setting))) { + if ((cur->name != NULL) && (STREQ(cur->name, setting))) break; - } prev = cur; cur = cur->next; } diff --git a/src/util/virdbus.c b/src/util/virdbus.c index 7c24cbf..8abb247 100644 --- a/src/util/virdbus.c +++ b/src/util/virdbus.c @@ -546,9 +546,8 @@ static void virDBusTypeStackFree(virDBusTypeStack **stack, /* The iter in the first level of the stack is the * root iter which must not be freed */ - for (i = 1; i < *nstack; i++) { + for (i = 1; i < *nstack; i++) VIR_FREE((*stack)[i].iter); - } VIR_FREE(*stack); } diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c index d2c4aa9..97652c0 100644 --- a/src/util/virdnsmasq.c +++ b/src/util/virdnsmasq.c @@ -726,9 +726,8 @@ dnsmasqCapsRefreshInternal(dnsmasqCapsPtr caps, bool force) caps->binaryPath); return -1; } - if (!force && caps->mtime == sb.st_mtime) { + if (!force && caps->mtime == sb.st_mtime) return 0; - } caps->mtime = sb.st_mtime; /* Make sure the binary we are about to try exec'ing exists. diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c index 13f40dc..ffda206 100644 --- a/src/util/vireventpoll.c +++ b/src/util/vireventpoll.c @@ -221,9 +221,8 @@ int virEventPollAddTimeout(int frequency, unsigned long long now; int ret; - if (virTimeMillisNow(&now) < 0) { + if (virTimeMillisNow(&now) < 0) return -1; - } virMutexLock(&eventLoop.lock); if (eventLoop.timeoutsCount == eventLoop.timeoutsAlloc) { @@ -270,9 +269,8 @@ void virEventPollUpdateTimeout(int timer, int frequency) return; } - if (virTimeMillisNow(&now) < 0) { + if (virTimeMillisNow(&now) < 0) return; - } virMutexLock(&eventLoop.lock); for (i = 0; i < eventLoop.timeoutsCount; i++) { @@ -643,9 +641,8 @@ int virEventPollRunOnce(void) ret = poll(fds, nfds, timeout); if (ret < 0) { EVENT_DEBUG("Poll got error event %d", errno); - if (errno == EINTR || errno == EAGAIN) { + if (errno == EINTR || errno == EAGAIN) goto retry; - } virReportSystemError(errno, "%s", _("Unable to poll on file handles")); goto error_unlocked; diff --git a/src/util/virfile.c b/src/util/virfile.c index 64f0e5b..b4d762f 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -1180,9 +1180,8 @@ virBuildPathInternal(char **path, ...) va_end(ap); *path = virBufferContentAndReset(&buf); - if (*path == NULL) { + if (*path == NULL) ret = -1; - } return ret; } @@ -2047,9 +2046,8 @@ virFileOpenForked(const char *path, int openflags, mode_t mode, /* XXX This makes assumptions about errno being < 255, which is * not true on Hurd. */ VIR_FORCE_CLOSE(pair[1]); - if (ret < 0) { + if (ret < 0) VIR_FORCE_CLOSE(fd); - } ret = -ret; if ((ret & 0xff) != ret) { VIR_WARN("unable to pass desired return value %d", ret); diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index bab1634..49afb78 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -321,9 +321,8 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, rule->queryOpaque = opaque; rule->ignoreErrors = ignoreErrors; - while ((str = va_arg(args, char *)) != NULL) { + while ((str = va_arg(args, char *)) != NULL) ADD_ARG(rule, str); - } if (group->addingRollback) { if (VIR_APPEND_ELEMENT_COPY(group->rollback, @@ -529,9 +528,8 @@ void virFirewallRuleAddArgList(virFirewallPtr firewall, va_start(list, rule); - while ((str = va_arg(list, char *)) != NULL) { + while ((str = va_arg(list, char *)) != NULL) ADD_ARG(rule, str); - } va_end(list); diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c index 5e29be9..ef8fb59 100644 --- a/src/util/viriscsi.c +++ b/src/util/viriscsi.c @@ -157,9 +157,8 @@ virStorageBackendIQNFound(const char *initiatoriqn, *newline = '\0'; iqn = strrchr(line, ','); - if (iqn == NULL) { + if (iqn == NULL) continue; - } iqn++; if (STREQ(iqn, initiatoriqn)) { @@ -185,9 +184,8 @@ virStorageBackendIQNFound(const char *initiatoriqn, ret = IQN_ERROR; out: - if (ret == IQN_MISSING) { + if (ret == IQN_MISSING) VIR_DEBUG("Could not find interface with IQN '%s'", iqn); - } VIR_FREE(line); VIR_FORCE_FCLOSE(fp); @@ -451,9 +449,8 @@ virISCSIScanTargets(const char *portal, *ntargetsret = list.ntargets; *targetsret = list.targets; } else { - for (i = 0; i < list.ntargets; i++) { + for (i = 0; i < list.ntargets; i++) VIR_FREE(list.targets[i]); - } VIR_FREE(list.targets); } diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c index 8969ab0..2366a74 100644 --- a/src/util/virlockspace.c +++ b/src/util/virlockspace.c @@ -679,9 +679,8 @@ int virLockSpaceReleaseResource(virLockSpacePtr lockspace, } for (i = 0; i < res->nOwners; i++) { - if (res->owners[i] == owner) { + if (res->owners[i] == owner) break; - } } if (i == res->nOwners) { @@ -723,9 +722,8 @@ virLockSpaceRemoveResourcesForOwner(const void *payload, VIR_DEBUG("res %s owner %lld", res->name, (unsigned long long)data->owner); for (i = 0; i < res->nOwners; i++) { - if (res->owners[i] == data->owner) { + if (res->owners[i] == data->owner) break; - } } if (i == res->nOwners) diff --git a/src/util/virlog.c b/src/util/virlog.c index 286ad9e..14eb129 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -578,9 +578,8 @@ virLogVMessage(virLogSourcePtr source, /* * serialize the error message, add level and timestamp */ - if (virVasprintfQuiet(&str, fmt, vargs) < 0) { + if (virVasprintfQuiet(&str, fmt, vargs) < 0) goto cleanup; - } ret = virLogFormatString(&msg, linenr, funcname, priority, str); if (ret < 0) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 3831009..3514978 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -1185,9 +1185,8 @@ virNetDevGetVirtualFunctions(const char *pfname, goto cleanup; } - if (virPCIGetNetName(pci_sysfs_device_link, &((*vfname)[i])) < 0) { + if (virPCIGetNetName(pci_sysfs_device_link, &((*vfname)[i])) < 0) VIR_INFO("VF does not have an interface name"); - } } ret = 0; @@ -1758,9 +1757,8 @@ virNetDevRestoreVfConfig(const char *pflinkdev, int vf, stateDir, pflinkdev, vf) < 0) return rc; - if (virFileReadAll(path, 128, &fileData) < 0) { + if (virFileReadAll(path, 128, &fileData) < 0) goto cleanup; - } if ((vlan = strchr(fileData, '\n'))) { char *endptr; diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c index d388358..15434de 100644 --- a/src/util/virnetdevbridge.c +++ b/src/util/virnetdevbridge.c @@ -265,9 +265,8 @@ int virNetDevBridgeCreate(const char *brname) goto cleanup; } - if (virNetDevSetName(ifr.ifr_name, brname) == -1) { + if (virNetDevSetName(ifr.ifr_name, brname) == -1) goto cleanup; - } ret = 0; cleanup: diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index c83341c..89e221d 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -682,9 +682,8 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr, } } - if (!indicate) { + if (!indicate) return; - } VIR_INFO("Re-send 802.1qbg associate request:"); VIR_INFO(" if: %s", calld->cr_ifname); @@ -851,9 +850,8 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *tgifname, return -1; if (ret) { - if (STRPREFIX(tgifname, prefix)) { + if (STRPREFIX(tgifname, prefix)) goto create_name; - } virReportSystemError(EEXIST, _("Unable to create macvlan device %s"), tgifname); return -1; @@ -983,9 +981,8 @@ int virNetDevMacVLanDeleteWithVPortProfile(const char *ifname, int ret = 0; int vf = -1; - if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) { + if (mode == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) ignore_value(virNetDevRestoreMacAddress(linkdev, stateDir)); - } if (ifname) { if (virNetDevVPortProfileDisassociate(ifname, diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c index 3674f9b..85688ab 100644 --- a/src/util/virnetdevtap.c +++ b/src/util/virnetdevtap.c @@ -108,9 +108,8 @@ virNetDevTapGetRealDeviceName(char *ifname ATTRIBUTE_UNUSED) while (virDirRead(dirp, &dp, "/dev") > 0) { if (STRPREFIX(dp->d_name, "tap")) { struct ifreq ifr; - if (virAsprintf(&devpath, "/dev/%s", dp->d_name) < 0) { + if (virAsprintf(&devpath, "/dev/%s", dp->d_name) < 0) goto cleanup; - } if ((fd = open(devpath, O_RDWR)) < 0) { if (errno == EBUSY) { VIR_FREE(devpath); @@ -444,9 +443,8 @@ int virNetDevTapCreate(char **ifname, VIR_FREE(dev_path); } - if (virNetDevSetName(ifr.ifr_name, *ifname) == -1) { + if (virNetDevSetName(ifr.ifr_name, *ifname) == -1) goto cleanup; - } ret = 0; diff --git a/src/util/virpci.c b/src/util/virpci.c index d8e465f..f60d0fa 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1127,9 +1127,8 @@ virPCIDeviceUnbindFromStub(virPCIDevicePtr dev) goto reprobe; /* Xen's pciback.ko wants you to use remove_slot on the specific device */ - if (virPCIDriverFile(&path, driver, "remove_slot") < 0) { + if (virPCIDriverFile(&path, driver, "remove_slot") < 0) goto cleanup; - } if (virFileExists(path) && virFileWriteStr(path, dev->name, 0) < 0) { virReportSystemError(errno, @@ -1214,9 +1213,8 @@ virPCIDeviceBindToStub(virPCIDevicePtr dev, * is triggered for such a device, it will also be immediately * bound by the stub. */ - if (virPCIDriverFile(&path, stubDriverName, "new_id") < 0) { + if (virPCIDriverFile(&path, stubDriverName, "new_id") < 0) goto cleanup; - } if (virFileWriteStr(path, dev->id, 0) < 0) { virReportSystemError(errno, @@ -1242,9 +1240,8 @@ virPCIDeviceBindToStub(virPCIDevicePtr dev, */ if (!virFileLinkPointsTo(driverLink, stubDriverPath)) { /* Xen's pciback.ko wants you to use new_slot first */ - if (virPCIDriverFile(&path, stubDriverName, "new_slot") < 0) { + if (virPCIDriverFile(&path, stubDriverName, "new_slot") < 0) goto remove_id; - } if (virFileExists(path) && virFileWriteStr(path, dev->name, 0) < 0) { virReportSystemError(errno, @@ -1255,9 +1252,8 @@ virPCIDeviceBindToStub(virPCIDevicePtr dev, } dev->remove_slot = true; - if (virPCIDriverFile(&path, stubDriverName, "bind") < 0) { + if (virPCIDriverFile(&path, stubDriverName, "bind") < 0) goto remove_id; - } if (virFileWriteStr(path, dev->name, 0) < 0) { virReportSystemError(errno, @@ -1505,9 +1501,8 @@ virPCIDeviceReadID(virPCIDevicePtr dev, const char *id_name) char *path = NULL; char *id_str; - if (virPCIFile(&path, dev->name, id_name) < 0) { + if (virPCIFile(&path, dev->name, id_name) < 0) return NULL; - } /* ID string is '0xNNNN\n' ... i.e. 7 bytes */ if (virFileReadAll(path, 7, &id_str) < 0) { diff --git a/src/util/virsexpr.c b/src/util/virsexpr.c index f8a0ccd..885c382 100644 --- a/src/util/virsexpr.c +++ b/src/util/virsexpr.c @@ -65,9 +65,8 @@ sexpr_free(struct sexpr *sexpr) { int serrno = errno; - if (sexpr == NULL) { + if (sexpr == NULL) return; - } switch (sexpr->kind) { case SEXPR_CONS: @@ -163,9 +162,8 @@ append(struct sexpr *lst, const struct sexpr *value) if (nil == NULL) return -1; - while (lst->kind != SEXPR_NIL) { + while (lst->kind != SEXPR_NIL) lst = lst->u.s.cdr; - } lst->kind = SEXPR_CONS; lst->u.s.car = (struct sexpr *) value; @@ -300,9 +298,8 @@ _string2sexpr(const char *buffer, size_t * end) ptr = trim(ptr + tmp_len); } - if (*ptr == ')') { + if (*ptr == ')') ptr++; - } } else { const char *start; @@ -394,13 +391,11 @@ sexpr_lookup_key(const struct sexpr *sexpr, const char *node) ptr = buffer; token = strsep(&ptr, "/"); - if (sexpr->kind != SEXPR_CONS || sexpr->u.s.car->kind != SEXPR_VALUE) { + if (sexpr->kind != SEXPR_CONS || sexpr->u.s.car->kind != SEXPR_VALUE) goto cleanup; - } - if (STRNEQ(sexpr->u.s.car->u.value, token)) { + if (STRNEQ(sexpr->u.s.car->u.value, token)) goto cleanup; - } for (token = strsep(&ptr, "/"); token; token = strsep(&ptr, "/")) { const struct sexpr *i; @@ -419,14 +414,12 @@ sexpr_lookup_key(const struct sexpr *sexpr, const char *node) } } - if (i->kind == SEXPR_NIL) { + if (i->kind == SEXPR_NIL) break; - } } - if (token != NULL) { + if (token != NULL) goto cleanup; - } result = (struct sexpr *) sexpr; @@ -538,9 +531,8 @@ sexpr_fmt_node(const struct sexpr *sexpr, const char *fmt, ...) result = virVasprintf(&node, fmt, ap); va_end(ap); - if (result < 0) { + if (result < 0) return NULL; - } value = sexpr_node(sexpr, node); diff --git a/src/util/virstorageencryption.c b/src/util/virstorageencryption.c index b5fed58..ec4a8cb 100644 --- a/src/util/virstorageencryption.c +++ b/src/util/virstorageencryption.c @@ -193,9 +193,8 @@ virStorageEncryptionParseXML(xmlXPathContextPtr ctxt) ret->format = format; n = virXPathNodeSet("./secret", ctxt, &nodes); - if (n < 0) { + if (n < 0) goto cleanup; - } if (n != 0 && VIR_ALLOC_N(ret->secrets, n) < 0) goto cleanup; ret->nsecrets = n; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 8e9d115..aa97f75 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1204,9 +1204,8 @@ int virStorageFileGetLVMKey(const char *path, char *tmp = *key; /* Find first non-space character */ - while (*tmp && c_isspace(*tmp)) { + while (*tmp && c_isspace(*tmp)) tmp++; - } /* Kill leading spaces */ if (tmp != *key) memmove(*key, tmp, strlen(tmp)+1); @@ -1919,9 +1918,8 @@ virStorageSourceInitChainElement(virStorageSourcePtr newelem, { int ret = -1; - if (force) { + if (force) virStorageSourceSeclabelsClear(newelem); - } if (!newelem->seclabels && virStorageSourceSeclabelsCopy(newelem, old) < 0) diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 1bb6392..d644dbc 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -179,9 +179,8 @@ virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret) eol = strchr(base, '\n'); cur = strchr(base, ':') + 1; - if (VIR_EXPAND_N(ret->processor, ret->nprocessor, 1) < 0) { + if (VIR_EXPAND_N(ret->processor, ret->nprocessor, 1) < 0) return -1; - } processor = &ret->processor[ret->nprocessor - 1]; virSkipSpaces(&cur); diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c index 4c46f28..98d2124 100644 --- a/src/util/virthreadpool.c +++ b/src/util/virthreadpool.c @@ -122,9 +122,8 @@ static void virThreadPoolWorker(void *opaque) if (job == pool->jobList.firstPrio) { virThreadPoolJobPtr tmp = job->next; while (tmp) { - if (tmp->priority) { + if (tmp->priority) break; - } tmp = tmp->next; } pool->jobList.firstPrio = tmp; diff --git a/src/util/virutil.c b/src/util/virutil.c index c178515..88c8baf 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -603,9 +603,8 @@ char *virIndexToDiskName(int idx, const char *prefix) strcpy(name, prefix); name[offset + i] = '\0'; - for (i = i - 1, ctr = idx; ctr >= 0; --i, ctr = ctr / 26 - 1) { + for (i = i - 1, ctr = idx; ctr >= 0; --i, ctr = ctr / 26 - 1) name[offset + i] = 'a' + (ctr % 26); - } return name; } @@ -1539,9 +1538,8 @@ virValidateWWN(const char *wwn) size_t i; const char *p = wwn; - if (STRPREFIX(wwn, "0x")) { + if (STRPREFIX(wwn, "0x")) p += 2; - } for (i = 0; p[i]; i++) { if (!c_isxdigit(p[i])) @@ -2563,9 +2561,8 @@ virGetListenFDs(void) VIR_DEBUG("Disabling inheritance of passed FD %d", fd); - if (virSetInherit(fd, false) < 0) { + if (virSetInherit(fd, false) < 0) VIR_WARN("Couldn't disable inheritance of passed FD %d", fd); - } } return nfds; diff --git a/src/util/virxml.c b/src/util/virxml.c index 27ecf14..7f591fb 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -185,9 +185,8 @@ virXPathLongBase(const char *xpath, } else if ((obj != NULL) && (obj->type == XPATH_NUMBER) && (!(isnan(obj->floatval)))) { *value = (long) obj->floatval; - if (*value != obj->floatval) { + if (*value != obj->floatval) ret = -2; - } } else { ret = -1; } @@ -291,9 +290,8 @@ virXPathULongBase(const char *xpath, } else if ((obj != NULL) && (obj->type == XPATH_NUMBER) && (!(isnan(obj->floatval)))) { *value = (unsigned long) obj->floatval; - if (*value != obj->floatval) { + if (*value != obj->floatval) ret = -2; - } } else { ret = -1; } @@ -408,9 +406,8 @@ virXPathULongLong(const char *xpath, } else if ((obj != NULL) && (obj->type == XPATH_NUMBER) && (!(isnan(obj->floatval)))) { *value = (unsigned long long) obj->floatval; - if (*value != obj->floatval) { + if (*value != obj->floatval) ret = -2; - } } else { ret = -1; } @@ -455,9 +452,8 @@ virXPathLongLong(const char *xpath, } else if ((obj != NULL) && (obj->type == XPATH_NUMBER) && (!(isnan(obj->floatval)))) { *value = (long long) obj->floatval; - if (*value != obj->floatval) { + if (*value != obj->floatval) ret = -2; - } } else { ret = -1; } @@ -655,9 +651,8 @@ catchXMLError(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...) base = ctxt->input->base; /* skip backwards over any end-of-lines */ - while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) { + while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) cur--; - } /* search backwards for beginning-of-line (to max buff size) */ while ((cur > base) && (*(cur) != '\n') && (*(cur) != '\r')) @@ -669,9 +664,8 @@ catchXMLError(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...) /* search forward for end-of-line (to max buff size) */ /* copy selected text to our buffer */ - while ((*cur != 0) && (*(cur) != '\n') && (*(cur) != '\r')) { + while ((*cur != 0) && (*(cur) != '\n') && (*(cur) != '\r')) virBufferAddChar(&buf, *cur++); - } /* create blank line with problem pointer */ contextstr = virBufferContentAndReset(&buf); -- 2.1.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list