mirror of https://gitee.com/openkylin/libvirt.git
build: avoid C99 for loop
Although we require various C99 features, we don't yet require a complete C99 compiler. On RHEL 5, compilation complained: qemu/qemu_command.c: In function 'qemuBuildGraphicsCommandLine': qemu/qemu_command.c:4688: error: 'for' loop initial declaration used outside C99 mode * src/qemu/qemu_command.c (qemuBuildGraphicsCommandLine): Declare variable sooner. * src/qemu/qemu_process.c (qemuProcessInitPasswords): Likewise.
This commit is contained in:
parent
067e83ebee
commit
7e5aa78d0f
|
@ -4429,6 +4429,8 @@ qemuBuildGraphicsCommandLine(struct qemud_driver *driver,
|
||||||
qemuCapsPtr caps,
|
qemuCapsPtr caps,
|
||||||
virDomainGraphicsDefPtr graphics)
|
virDomainGraphicsDefPtr graphics)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
||||||
virBuffer opt = VIR_BUFFER_INITIALIZER;
|
virBuffer opt = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
|
@ -4685,7 +4687,7 @@ qemuBuildGraphicsCommandLine(struct qemud_driver *driver,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0 ; i < VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST ; i++) {
|
for (i = 0 ; i < VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST ; i++) {
|
||||||
int mode = graphics->data.spice.channels[i];
|
int mode = graphics->data.spice.channels[i];
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
|
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
|
||||||
|
|
|
@ -2078,8 +2078,9 @@ qemuProcessInitPasswords(virConnectPtr conn,
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
int i;
|
||||||
|
|
||||||
for (int i = 0 ; i < vm->def->ngraphics; ++i) {
|
for (i = 0 ; i < vm->def->ngraphics; ++i) {
|
||||||
virDomainGraphicsDefPtr graphics = vm->def->graphics[i];
|
virDomainGraphicsDefPtr graphics = vm->def->graphics[i];
|
||||||
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
|
||||||
ret = qemuDomainChangeGraphicsPasswords(driver, vm,
|
ret = qemuDomainChangeGraphicsPasswords(driver, vm,
|
||||||
|
@ -2098,8 +2099,6 @@ qemuProcessInitPasswords(virConnectPtr conn,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0 ; i < vm->def->ndisks ; i++) {
|
for (i = 0 ; i < vm->def->ndisks ; i++) {
|
||||||
char *secret;
|
char *secret;
|
||||||
size_t secretLen;
|
size_t secretLen;
|
||||||
|
|
Loading…
Reference in New Issue