[client] main: use ARRAY_LENGTH macro

This commit is contained in:
Quantum 2021-08-13 04:20:57 -04:00 committed by Geoffrey McRae
parent 074341e421
commit a76b274e1a

View File

@ -38,6 +38,7 @@
#include <stdatomic.h> #include <stdatomic.h>
#include <linux/input.h> #include <linux/input.h>
#include "common/array.h"
#include "common/debug.h" #include "common/debug.h"
#include "common/crash.h" #include "common/crash.h"
#include "common/KVMFR.h" #include "common/KVMFR.h"
@ -631,7 +632,7 @@ int main_frameThread(void * unused)
if (g_state.useDMA) if (g_state.useDMA)
{ {
/* find the existing dma buffer if it exists */ /* find the existing dma buffer if it exists */
for(int i = 0; i < sizeof(dmaInfo) / sizeof(struct DMAFrameInfo); ++i) for(int i = 0; i < ARRAY_LENGTH(dmaInfo); ++i)
{ {
if (dmaInfo[i].frame == frame) if (dmaInfo[i].frame == frame)
{ {
@ -648,7 +649,7 @@ int main_frameThread(void * unused)
/* otherwise find a free buffer for use */ /* otherwise find a free buffer for use */
if (!dma) if (!dma)
for(int i = 0; i < sizeof(dmaInfo) / sizeof(struct DMAFrameInfo); ++i) for(int i = 0; i < ARRAY_LENGTH(dmaInfo); ++i)
{ {
if (!dmaInfo[i].frame) if (!dmaInfo[i].frame)
{ {
@ -721,7 +722,7 @@ int main_frameThread(void * unused)
if (g_state.useDMA) if (g_state.useDMA)
{ {
for(int i = 0; i < sizeof(dmaInfo) / sizeof(struct DMAFrameInfo); ++i) for(int i = 0; i < ARRAY_LENGTH(dmaInfo); ++i)
if (dmaInfo[i].fd >= 0) if (dmaInfo[i].fd >= 0)
close(dmaInfo[i].fd); close(dmaInfo[i].fd);
} }