summaryrefslogtreecommitdiff
path: root/tools/virsh-pool.c
diff options
context:
space:
mode:
authorJán Tomko <jtomko@redhat.com>2019-10-18 17:24:02 +0200
committerJán Tomko <jtomko@redhat.com>2019-10-20 14:37:16 +0200
commitc937c1d23db00cf0f33091f9d30f7ac33d9d6aa4 (patch)
tree2aa4323eb45793b5d858a0bd8b5f44183748c3cf /tools/virsh-pool.c
parent7863f1547a9d3bbc09e5023b51f5b7bf5dad911c (diff)
downloadlibvirt-c937c1d23db00cf0f33091f9d30f7ac33d9d6aa4.tar.gz
tools: prefer g_strdup to vshStrdup
Remove all the uses of vshStrdup in favor of GLib's g_strdup. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Diffstat (limited to 'tools/virsh-pool.c')
-rw-r--r--tools/virsh-pool.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index bb25840943..bd876aefda 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -1247,10 +1247,9 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
/* Retrieve the autostart status of the pool */
if (virStoragePoolGetAutostart(list->pools[i], &autostart) < 0)
- poolInfoTexts[i].autostart = vshStrdup(ctl, _("no autostart"));
+ poolInfoTexts[i].autostart = g_strdup(_("no autostart"));
else
- poolInfoTexts[i].autostart = vshStrdup(ctl, autostart ?
- _("yes") : _("no"));
+ poolInfoTexts[i].autostart = g_strdup(autostart ? _("yes") : _("no"));
/* Retrieve the persistence status of the pool */
if (details) {
@@ -1258,28 +1257,27 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
vshDebug(ctl, VSH_ERR_DEBUG, "Persistent flag value: %d\n",
persistent);
if (persistent < 0)
- poolInfoTexts[i].persistent = vshStrdup(ctl, _("unknown"));
+ poolInfoTexts[i].persistent = g_strdup(_("unknown"));
else
- poolInfoTexts[i].persistent = vshStrdup(ctl, persistent ?
- _("yes") : _("no"));
+ poolInfoTexts[i].persistent = g_strdup(persistent ? _("yes") : _("no"));
}
/* Collect further extended information about the pool */
if (virStoragePoolGetInfo(list->pools[i], &info) != 0) {
/* Something went wrong retrieving pool info, cope with it */
vshError(ctl, "%s", _("Could not retrieve pool information"));
- poolInfoTexts[i].state = vshStrdup(ctl, _("unknown"));
+ poolInfoTexts[i].state = g_strdup(_("unknown"));
if (details) {
- poolInfoTexts[i].capacity = vshStrdup(ctl, _("unknown"));
- poolInfoTexts[i].allocation = vshStrdup(ctl, _("unknown"));
- poolInfoTexts[i].available = vshStrdup(ctl, _("unknown"));
+ poolInfoTexts[i].capacity = g_strdup(_("unknown"));
+ poolInfoTexts[i].allocation = g_strdup(_("unknown"));
+ poolInfoTexts[i].available = g_strdup(_("unknown"));
}
} else {
/* Decide which state string to display */
if (details) {
const char *state = virshStoragePoolStateToString(info.state);
- poolInfoTexts[i].state = vshStrdup(ctl, state);
+ poolInfoTexts[i].state = g_strdup(state);
/* Create the pool size related strings */
if (info.state == VIR_STORAGE_POOL_RUNNING ||
@@ -1303,17 +1301,17 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
goto cleanup;
} else {
/* Capacity related information isn't available */
- poolInfoTexts[i].capacity = vshStrdup(ctl, _("-"));
- poolInfoTexts[i].allocation = vshStrdup(ctl, _("-"));
- poolInfoTexts[i].available = vshStrdup(ctl, _("-"));
+ poolInfoTexts[i].capacity = g_strdup(_("-"));
+ poolInfoTexts[i].allocation = g_strdup(_("-"));
+ poolInfoTexts[i].available = g_strdup(_("-"));
}
} else {
/* --details option was not specified, only active/inactive
* state strings are used */
if (virStoragePoolIsActive(list->pools[i]))
- poolInfoTexts[i].state = vshStrdup(ctl, _("active"));
+ poolInfoTexts[i].state = g_strdup(_("active"));
else
- poolInfoTexts[i].state = vshStrdup(ctl, _("inactive"));
+ poolInfoTexts[i].state = g_strdup(_("inactive"));
}
}
}