mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
vircommand: Simplify virCommandAddArg
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
ae9f4d5e0c
commit
8b1755024b
@ -1520,8 +1520,6 @@ virCommandAddEnvXDG(virCommandPtr cmd, const char *baseDir)
|
||||
void
|
||||
virCommandAddArg(virCommandPtr cmd, const char *val)
|
||||
{
|
||||
char *arg;
|
||||
|
||||
if (!cmd || cmd->has_error)
|
||||
return;
|
||||
|
||||
@ -1530,16 +1528,13 @@ virCommandAddArg(virCommandPtr cmd, const char *val)
|
||||
return;
|
||||
}
|
||||
|
||||
arg = g_strdup(val);
|
||||
|
||||
/* Arg plus trailing NULL. */
|
||||
if (VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, 1 + 1) < 0) {
|
||||
VIR_FREE(arg);
|
||||
cmd->has_error = ENOMEM;
|
||||
return;
|
||||
}
|
||||
|
||||
cmd->args[cmd->nargs++] = arg;
|
||||
cmd->args[cmd->nargs++] = g_strdup(val);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user