Skip to contentSkip to conversation

examples/power: fix build

PATCH Applied David Hunt 2 participants 2 messages Oct 13, 2017

lore
Share & tools
lore

David Hunt

author
#0 lore raw

PATCH 1/1 examples/power: fix build

Remove variable declaration from within for loop.

Fixes f14791a8126e ("examples/vm_power_mgr: add policy to channels")
---
 examples/vm_power_manager/channel_monitor.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
examples/vm_power_manager/channel_monitor.c +6 -3
index f16358d..f8e3491 100644
@@ -169,8 +169,9 @@ update_policy(struct channel_packet *pkt)
 {
 
 	unsigned int updated = 0;
+	int i;
 
-	for (int i = 0; i < MAX_VMS; i++) {
+	for (i = 0; i < MAX_VMS; i++) {
 		if (strcmp(policies[i].pkt.vm_name, pkt->vm_name) == 0) {
 			policies[i].pkt = *pkt;
 			get_pcpu_to_control(&policies[i]);
@@ -184,7 +185,7 @@ update_policy(struct channel_packet *pkt)
 		}
 	}
 	if (!updated) {
-		for (int i = 0; i < MAX_VMS; i++) {
+		for (i = 0; i < MAX_VMS; i++) {
 			if (policies[i].enabled == 0) {
 				policies[i].pkt = *pkt;
 				get_pcpu_to_control(&policies[i]);
@@ -543,7 +544,9 @@ run_channel_monitor(void)
 		}
 		rte_delay_us(time_period_s*1000000);
 		if (policy_is_set) {
-			for (int j = 0; j < MAX_VMS; j++) {
+			int j;
+
+			for (j = 0; j < MAX_VMS; j++) {
 				if (policies[j].enabled == 1)
 					apply_policy(&policies[j]);
 			}
Signature · 1 line
2.7.4
#1 lore raw

13/10/2017 14:31, David Hunt:

Quoted 5 lines

Remove variable declaration from within for loop.

Fixes f14791a8126e ("examples/vm_power_mgr: add policy to channels")

Applied, thanks