Use indexing in preference to pointer arithmetic.
Change-Id: Ia90714e95af1e545f626bd5b6c99e40622e37286
diff --git a/src/api.c b/src/api.c
index 947982c..8195ad6 100644
--- a/src/api.c
+++ b/src/api.c
@@ -79,12 +79,12 @@
return HF_VCPU_RUN_RESPONSE(HF_VCPU_RUN_WAIT_FOR_INTERRUPT, 0);
}
- vm = secondary_vm + vm_idx;
+ vm = &secondary_vm[vm_idx];
if (vcpu_idx >= vm->vcpu_count) {
return HF_VCPU_RUN_RESPONSE(HF_VCPU_RUN_WAIT_FOR_INTERRUPT, 0);
}
- vcpu = vm->vcpus + vcpu_idx;
+ vcpu = &vm->vcpus[vcpu_idx];
sl_lock(&vcpu->lock);
if (vcpu->state != vcpu_state_ready) {
@@ -224,7 +224,7 @@
return -1;
}
- to = secondary_vm + vm_idx;
+ to = &secondary_vm[vm_idx];
sl_lock(&to->lock);
if (to->rpc.state != rpc_state_idle || !to->rpc.recv) {