mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
tools: use g_strdup instead of VIR_STRDUP
Replace all occurrences of if (VIR_STRDUP(a, b) < 0) /* effectively dead code */ with: a = g_strdup(b); Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
29b1e859e3
commit
506d313fa1
@ -56,8 +56,7 @@ virshCheckpointNameCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < ncheckpoints; i++) {
|
for (i = 0; i < ncheckpoints; i++) {
|
||||||
const char *name = virDomainCheckpointGetName(checkpoints[i]);
|
const char *name = virDomainCheckpointGetName(checkpoints[i]);
|
||||||
|
|
||||||
if (VIR_STRDUP(ret[i], name) < 0)
|
ret[i] = g_strdup(name);
|
||||||
goto error;
|
|
||||||
|
|
||||||
virshDomainCheckpointFree(checkpoints[i]);
|
virshDomainCheckpointFree(checkpoints[i]);
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,7 @@ virshDomainNameCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < ndomains; i++) {
|
for (i = 0; i < ndomains; i++) {
|
||||||
const char *name = virDomainGetName(domains[i]);
|
const char *name = virDomainGetName(domains[i]);
|
||||||
|
|
||||||
if (VIR_STRDUP(tmp[i], name) < 0)
|
tmp[i] = g_strdup(name);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
@ -181,10 +180,8 @@ virshDomainEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
if (VIR_ALLOC_N(tmp, VIR_DOMAIN_EVENT_ID_LAST + 1) < 0)
|
if (VIR_ALLOC_N(tmp, VIR_DOMAIN_EVENT_ID_LAST + 1) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++) {
|
for (i = 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++)
|
||||||
if (VIR_STRDUP(tmp[i], virshDomainEventCallbacks[i].name) < 0)
|
tmp[i] = g_strdup(virshDomainEventCallbacks[i].name);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
return ret;
|
return ret;
|
||||||
@ -242,11 +239,9 @@ virshDomainInterfaceStateCompleter(vshControl *ctl,
|
|||||||
|
|
||||||
if ((state = virXPathString("string(./link/@state)", ctxt)) &&
|
if ((state = virXPathString("string(./link/@state)", ctxt)) &&
|
||||||
STREQ(state, "down")) {
|
STREQ(state, "down")) {
|
||||||
if (VIR_STRDUP(tmp[0], "up") < 0)
|
tmp[0] = g_strdup("up");
|
||||||
return NULL;
|
|
||||||
} else {
|
} else {
|
||||||
if (VIR_STRDUP(tmp[0], "down") < 0)
|
tmp[0] = g_strdup("down");
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
|
@ -53,8 +53,7 @@ virshInterfaceNameCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < nifaces; i++) {
|
for (i = 0; i < nifaces; i++) {
|
||||||
const char *name = virInterfaceGetName(ifaces[i]);
|
const char *name = virInterfaceGetName(ifaces[i]);
|
||||||
|
|
||||||
if (VIR_STRDUP(tmp[i], name) < 0)
|
tmp[i] = g_strdup(name);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
|
@ -55,8 +55,7 @@ virshNetworkNameCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < nnets; i++) {
|
for (i = 0; i < nnets; i++) {
|
||||||
const char *name = virNetworkGetName(nets[i]);
|
const char *name = virNetworkGetName(nets[i]);
|
||||||
|
|
||||||
if (VIR_STRDUP(tmp[i], name) < 0)
|
tmp[i] = g_strdup(name);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
@ -83,10 +82,8 @@ virshNetworkEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
if (VIR_ALLOC_N(tmp, VIR_NETWORK_EVENT_ID_LAST + 1) < 0)
|
if (VIR_ALLOC_N(tmp, VIR_NETWORK_EVENT_ID_LAST + 1) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (i = 0; i < VIR_NETWORK_EVENT_ID_LAST; i++) {
|
for (i = 0; i < VIR_NETWORK_EVENT_ID_LAST; i++)
|
||||||
if (VIR_STRDUP(tmp[i], virshNetworkEventCallbacks[i].name) < 0)
|
tmp[i] = g_strdup(virshNetworkEventCallbacks[i].name);
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
|
|
||||||
@ -124,10 +121,11 @@ virshNetworkPortUUIDCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < nports; i++) {
|
for (i = 0; i < nports; i++) {
|
||||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||||
|
|
||||||
if (virNetworkPortGetUUIDString(ports[i], uuid) < 0 ||
|
if (virNetworkPortGetUUIDString(ports[i], uuid) < 0)
|
||||||
VIR_STRDUP(ret[i], uuid) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
ret[i] = g_strdup(uuid);
|
||||||
|
|
||||||
virNetworkPortFree(ports[i]);
|
virNetworkPortFree(ports[i]);
|
||||||
}
|
}
|
||||||
VIR_FREE(ports);
|
VIR_FREE(ports);
|
||||||
|
@ -53,8 +53,7 @@ virshNodeDeviceNameCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < ndevs; i++) {
|
for (i = 0; i < ndevs; i++) {
|
||||||
const char *name = virNodeDeviceGetName(devs[i]);
|
const char *name = virNodeDeviceGetName(devs[i]);
|
||||||
|
|
||||||
if (VIR_STRDUP(tmp[i], name) < 0)
|
tmp[i] = g_strdup(name);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
@ -81,10 +80,8 @@ virshNodeDeviceEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
if (VIR_ALLOC_N(tmp, VIR_NODE_DEVICE_EVENT_ID_LAST + 1) < 0)
|
if (VIR_ALLOC_N(tmp, VIR_NODE_DEVICE_EVENT_ID_LAST + 1) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++) {
|
for (i = 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++)
|
||||||
if (VIR_STRDUP(tmp[i], virshNodeDeviceEventCallbacks[i].name) < 0)
|
tmp[i] = g_strdup(virshNodeDeviceEventCallbacks[i].name);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
return ret;
|
return ret;
|
||||||
@ -108,10 +105,8 @@ virshNodeDeviceCapabilityNameCompleter(vshControl *ctl,
|
|||||||
if (VIR_ALLOC_N(tmp, VIR_NODE_DEV_CAP_LAST + 1) < 0)
|
if (VIR_ALLOC_N(tmp, VIR_NODE_DEV_CAP_LAST + 1) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < VIR_NODE_DEV_CAP_LAST; i++) {
|
for (i = 0; i < VIR_NODE_DEV_CAP_LAST; i++)
|
||||||
if (VIR_STRDUP(tmp[i], virNodeDevCapTypeToString(i)) < 0)
|
tmp[i] = g_strdup(virNodeDevCapTypeToString(i));
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return virshCommaStringListComplete(cap_str, (const char **)tmp);
|
return virshCommaStringListComplete(cap_str, (const char **)tmp);
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,7 @@ virshNWFilterNameCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < nnwfilters; i++) {
|
for (i = 0; i < nnwfilters; i++) {
|
||||||
const char *name = virNWFilterGetName(nwfilters[i]);
|
const char *name = virNWFilterGetName(nwfilters[i]);
|
||||||
|
|
||||||
if (VIR_STRDUP(tmp[i], name) < 0)
|
tmp[i] = g_strdup(name);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
@ -91,8 +90,7 @@ virshNWFilterBindingNameCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < nbindings; i++) {
|
for (i = 0; i < nbindings; i++) {
|
||||||
const char *name = virNWFilterBindingGetPortDev(bindings[i]);
|
const char *name = virNWFilterBindingGetPortDev(bindings[i]);
|
||||||
|
|
||||||
if (VIR_STRDUP(tmp[i], name) < 0)
|
tmp[i] = g_strdup(name);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
|
@ -56,8 +56,7 @@ virshStoragePoolNameCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < npools; i++) {
|
for (i = 0; i < npools; i++) {
|
||||||
const char *name = virStoragePoolGetName(pools[i]);
|
const char *name = virStoragePoolGetName(pools[i]);
|
||||||
|
|
||||||
if (VIR_STRDUP(tmp[i], name) < 0)
|
tmp[i] = g_strdup(name);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
@ -84,10 +83,8 @@ virshPoolEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
if (VIR_ALLOC_N(tmp, VIR_STORAGE_POOL_EVENT_ID_LAST + 1) < 0)
|
if (VIR_ALLOC_N(tmp, VIR_STORAGE_POOL_EVENT_ID_LAST + 1) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) {
|
for (i = 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++)
|
||||||
if (VIR_STRDUP(tmp[i], virshPoolEventCallbacks[i].name) < 0)
|
tmp[i] = g_strdup(virshPoolEventCallbacks[i].name);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
return ret;
|
return ret;
|
||||||
@ -111,10 +108,8 @@ virshPoolTypeCompleter(vshControl *ctl,
|
|||||||
if (VIR_ALLOC_N(tmp, VIR_STORAGE_POOL_LAST + 1) < 0)
|
if (VIR_ALLOC_N(tmp, VIR_STORAGE_POOL_LAST + 1) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < VIR_STORAGE_POOL_LAST; i++) {
|
for (i = 0; i < VIR_STORAGE_POOL_LAST; i++)
|
||||||
if (VIR_STRDUP(tmp[i], virStoragePoolTypeToString(i)) < 0)
|
tmp[i] = g_strdup(virStoragePoolTypeToString(i));
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return virshCommaStringListComplete(type_str, (const char **)tmp);
|
return virshCommaStringListComplete(type_str, (const char **)tmp);
|
||||||
}
|
}
|
||||||
|
@ -52,9 +52,9 @@ virshSecretUUIDCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < nsecrets; i++) {
|
for (i = 0; i < nsecrets; i++) {
|
||||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||||
|
|
||||||
if (virSecretGetUUIDString(secrets[i], uuid) < 0 ||
|
if (virSecretGetUUIDString(secrets[i], uuid) < 0)
|
||||||
VIR_STRDUP(tmp[i], uuid) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
tmp[i] = g_strdup(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
@ -81,10 +81,8 @@ virshSecretEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
|
|||||||
if (VIR_ALLOC_N(tmp, VIR_SECRET_EVENT_ID_LAST + 1) < 0)
|
if (VIR_ALLOC_N(tmp, VIR_SECRET_EVENT_ID_LAST + 1) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < VIR_SECRET_EVENT_ID_LAST; i++) {
|
for (i = 0; i < VIR_SECRET_EVENT_ID_LAST; i++)
|
||||||
if (VIR_STRDUP(tmp[i], virshSecretEventCallbacks[i].name) < 0)
|
tmp[i] = g_strdup(virshSecretEventCallbacks[i].name);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -58,8 +58,7 @@ virshSnapshotNameCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < nsnapshots; i++) {
|
for (i = 0; i < nsnapshots; i++) {
|
||||||
const char *name = virDomainSnapshotGetName(snapshots[i]);
|
const char *name = virDomainSnapshotGetName(snapshots[i]);
|
||||||
|
|
||||||
if (VIR_STRDUP(tmp[i], name) < 0)
|
tmp[i] = g_strdup(name);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
|
@ -58,8 +58,7 @@ virshStorageVolNameCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < nvols; i++) {
|
for (i = 0; i < nvols; i++) {
|
||||||
const char *name = virStorageVolGetName(vols[i]);
|
const char *name = virStorageVolGetName(vols[i]);
|
||||||
|
|
||||||
if (VIR_STRDUP(tmp[i], name) < 0)
|
tmp[i] = g_strdup(name);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_steal_pointer(&tmp);
|
ret = g_steal_pointer(&tmp);
|
||||||
|
@ -100,8 +100,7 @@ virshCommaStringListComplete(const char *input,
|
|||||||
if (input) {
|
if (input) {
|
||||||
char *comma = NULL;
|
char *comma = NULL;
|
||||||
|
|
||||||
if (VIR_STRDUP(inputCopy, input) < 0)
|
inputCopy = g_strdup(input);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if ((comma = strrchr(inputCopy, ',')))
|
if ((comma = strrchr(inputCopy, ',')))
|
||||||
*comma = '\0';
|
*comma = '\0';
|
||||||
@ -119,9 +118,10 @@ virshCommaStringListComplete(const char *input,
|
|||||||
if (virStringListHasString((const char **)inputList, options[i]))
|
if (virStringListHasString((const char **)inputList, options[i]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((inputCopy && virAsprintf(&ret[nret], "%s,%s", inputCopy, options[i]) < 0) ||
|
if (inputCopy && virAsprintf(&ret[nret], "%s,%s", inputCopy, options[i]) < 0)
|
||||||
(!inputCopy && VIR_STRDUP(ret[nret], options[i]) < 0))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (!inputCopy)
|
||||||
|
ret[nret] = g_strdup(options[i]);
|
||||||
|
|
||||||
nret++;
|
nret++;
|
||||||
}
|
}
|
||||||
|
@ -53,8 +53,7 @@ vshAdmServerCompleter(vshControl *ctl,
|
|||||||
for (i = 0; i < nsrvs; i++) {
|
for (i = 0; i < nsrvs; i++) {
|
||||||
const char *name = virAdmServerGetName(srvs[i]);
|
const char *name = virAdmServerGetName(srvs[i]);
|
||||||
|
|
||||||
if (VIR_STRDUP(ret[i], name) < 0)
|
ret[i] = g_strdup(name);
|
||||||
goto error;
|
|
||||||
|
|
||||||
virAdmServerFree(srvs[i]);
|
virAdmServerFree(srvs[i]);
|
||||||
}
|
}
|
||||||
|
@ -102,10 +102,7 @@ static int virLoginShellGetShellArgv(virConfPtr conf,
|
|||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
if (VIR_ALLOC_N(*shargv, 2) < 0)
|
if (VIR_ALLOC_N(*shargv, 2) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (VIR_STRDUP((*shargv)[0], "/bin/sh") < 0) {
|
(*shargv)[0] = g_strdup("/bin/sh");
|
||||||
VIR_FREE(*shargv);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
*shargvlen = 1;
|
*shargvlen = 1;
|
||||||
} else {
|
} else {
|
||||||
*shargvlen = virStringListLength((const char *const *)shargv);
|
*shargvlen = virStringListLength((const char *const *)shargv);
|
||||||
@ -347,10 +344,8 @@ main(int argc, char **argv)
|
|||||||
if (cmdstr) {
|
if (cmdstr) {
|
||||||
if (VIR_REALLOC_N(shargv, shargvlen + 3) < 0)
|
if (VIR_REALLOC_N(shargv, shargvlen + 3) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
if (VIR_STRDUP(shargv[shargvlen++], "-c") < 0)
|
shargv[shargvlen++] = g_strdup("-c");
|
||||||
goto cleanup;
|
shargv[shargvlen++] = g_strdup(cmdstr);
|
||||||
if (VIR_STRDUP(shargv[shargvlen++], cmdstr) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
shargv[shargvlen] = NULL;
|
shargv[shargvlen] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,15 +361,13 @@ main(int argc, char **argv)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
tmp = strrchr(shcmd, '/');
|
tmp = strrchr(shcmd, '/');
|
||||||
if (VIR_STRDUP(shargv[0], tmp) < 0)
|
shargv[0] = g_strdup(tmp);
|
||||||
goto cleanup;
|
|
||||||
shargv[0][0] = '-';
|
shargv[0][0] = '-';
|
||||||
|
|
||||||
/* We're duping the string because the clearenv()
|
/* We're duping the string because the clearenv()
|
||||||
* call will shortly release the pointer we get
|
* call will shortly release the pointer we get
|
||||||
* back from getenv() right here */
|
* back from getenv() right here */
|
||||||
if (VIR_STRDUP(term, getenv("TERM")) < 0)
|
term = g_strdup(getenv("TERM"));
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
/* A fork is required to create new process in correct pid namespace. */
|
/* A fork is required to create new process in correct pid namespace. */
|
||||||
if ((cpid = virFork()) < 0)
|
if ((cpid = virFork()) < 0)
|
||||||
|
@ -104,8 +104,7 @@ vshTableRowNew(const char *arg, va_list ap)
|
|||||||
while (arg) {
|
while (arg) {
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
|
|
||||||
if (VIR_STRDUP(tmp, arg) < 0)
|
tmp = g_strdup(arg);
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (VIR_APPEND_ELEMENT(row->cells, row->ncells, tmp) < 0) {
|
if (VIR_APPEND_ELEMENT(row->cells, row->ncells, tmp) < 0) {
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
|
11
tools/vsh.c
11
tools/vsh.c
@ -495,8 +495,7 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name,
|
|||||||
opt->help = "string=value": treat boolean flag as
|
opt->help = "string=value": treat boolean flag as
|
||||||
alias of option and its default value */
|
alias of option and its default value */
|
||||||
sa_assert(!alias);
|
sa_assert(!alias);
|
||||||
if (VIR_STRDUP(alias, opt->help) < 0)
|
alias = g_strdup(opt->help);
|
||||||
goto cleanup;
|
|
||||||
name = alias;
|
name = alias;
|
||||||
if ((value = strchr(name, '='))) {
|
if ((value = strchr(name, '='))) {
|
||||||
*value = '\0';
|
*value = '\0';
|
||||||
@ -506,8 +505,7 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name,
|
|||||||
opt->name);
|
opt->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (VIR_STRDUP(*optstr, value + 1) < 0)
|
*optstr = g_strdup(value + 1);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3500,9 +3498,8 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
vshReadlineInit(ctl);
|
vshReadlineInit(ctl);
|
||||||
|
|
||||||
if (!(rl_line_buffer = virBufferContentAndReset(&buf)) &&
|
if (!(rl_line_buffer = virBufferContentAndReset(&buf)))
|
||||||
VIR_STRDUP(rl_line_buffer, "") < 0)
|
rl_line_buffer = g_strdup("");
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
/* rl_point is current cursor position in rl_line_buffer.
|
/* rl_point is current cursor position in rl_line_buffer.
|
||||||
* In our case it's at the end of the whole line. */
|
* In our case it's at the end of the whole line. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user