提交 2ab95531 编写于 作者: J Ján Tomko

vboxDumpDisplay: use VIR_APPEND_ELEMENT

Instead of open-coding it.
上级 ec74a9da
...@@ -3363,14 +3363,9 @@ vboxDumpDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) ...@@ -3363,14 +3363,9 @@ vboxDumpDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
goto cleanup; goto cleanup;
} }
if (graphics) { if (graphics &&
if (VIR_ALLOC_N(def->graphics, 1) < 0) VIR_APPEND_ELEMENT(def->graphics, def->ngraphics, graphics) < 0)
goto cleanup; goto cleanup;
def->graphics[def->ngraphics] = graphics;
graphics = NULL;
def->ngraphics++;
}
gVBoxAPI.UIMachine.GetVRDxServer(machine, &VRDxServer); gVBoxAPI.UIMachine.GetVRDxServer(machine, &VRDxServer);
if (VRDxServer) if (VRDxServer)
...@@ -3407,12 +3402,8 @@ vboxDumpDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine) ...@@ -3407,12 +3402,8 @@ vboxDumpDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
if (reuseSingleConnection) if (reuseSingleConnection)
graphics->data.rdp.replaceUser = true; graphics->data.rdp.replaceUser = true;
if (VIR_REALLOC_N(def->graphics, def->ngraphics + 1) < 0) if (VIR_APPEND_ELEMENT(def->graphics, def->ngraphics, graphics) < 0)
goto cleanup; goto cleanup;
def->graphics[def->ngraphics] = graphics;
graphics = NULL;
def->ngraphics++;
} }
ret = 0; ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册