tools: Use g_strdup_printf() instead of virAsprintf()

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Michal Privoznik
2019-10-22 15:26:14 +02:00
parent 4fa804c0c7
commit 26a137093b
12 changed files with 61 additions and 103 deletions

View File

@@ -1426,14 +1426,11 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
volInfoTexts[i].type = g_strdup(virshVolumeTypeToString(volumeInfo.type));
val = vshPrettyCapacity(volumeInfo.capacity, &unit);
if (virAsprintf(&volInfoTexts[i].capacity,
"%.2lf %s", val, unit) < 0)
goto cleanup;
volInfoTexts[i].capacity = g_strdup_printf("%.2lf %s", val, unit);
val = vshPrettyCapacity(volumeInfo.allocation, &unit);
if (virAsprintf(&volInfoTexts[i].allocation,
"%.2lf %s", val, unit) < 0)
goto cleanup;
volInfoTexts[i].allocation = g_strdup_printf("%.2lf %s", val,
unit);
}
}
}