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:
Eric Blake 2012-11-26 09:25:21 -07:00
parent 067e83ebee
commit 7e5aa78d0f
2 changed files with 5 additions and 4 deletions

View File

@ -4429,6 +4429,8 @@ qemuBuildGraphicsCommandLine(struct qemud_driver *driver,
qemuCapsPtr caps,
virDomainGraphicsDefPtr graphics)
{
int i;
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
virBuffer opt = VIR_BUFFER_INITIALIZER;
@ -4685,7 +4687,7 @@ qemuBuildGraphicsCommandLine(struct qemud_driver *driver,
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];
switch (mode) {
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:

View File

@ -2078,8 +2078,9 @@ qemuProcessInitPasswords(virConnectPtr conn,
{
int ret = 0;
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];
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
ret = qemuDomainChangeGraphicsPasswords(driver, vm,
@ -2098,8 +2099,6 @@ qemuProcessInitPasswords(virConnectPtr conn,
goto cleanup;
if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
int i;
for (i = 0 ; i < vm->def->ndisks ; i++) {
char *secret;
size_t secretLen;