summaryrefslogtreecommitdiff
path: root/lib/drmtest.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-09-11 10:40:25 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-09-11 10:40:25 +0200
commit2b218f69d7e2892ed1a2a2b3bc9663c35acee288 (patch)
tree7b4977156ca24a68b179f5d5011b6254f5f3a01c /lib/drmtest.c
parent57e67461812eb3a1c123e590b0cf08b885417732 (diff)
lib/drmtest: Use ARRAY_SIZE
Less fragile ... Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r--lib/drmtest.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index a90e2af4..ee74aa05 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -944,20 +944,19 @@ void igt_exit(void)
}
static int helper_process_count;
-#define NUM_HELPER_PROCS 4
-static pid_t helper_process_pids[NUM_HELPER_PROCS] =
+static pid_t helper_process_pids[] =
{ -1, -1, -1, -1};
static void reset_helper_process_list(void)
{
- for (int i = 0; i < NUM_HELPER_PROCS; i++)
+ for (int i = 0; i < ARRAY_SIZE(helper_process_pids); i++)
helper_process_pids[i] = -1;
helper_process_count = 0;
}
static void fork_helper_exit_handler(int sig)
{
- for (int i = 0; i < NUM_HELPER_PROCS; i++) {
+ for (int i = 0; i < ARRAY_SIZE(helper_process_pids); i++) {
pid_t pid = helper_process_pids[i];
int status;
@@ -981,7 +980,7 @@ bool __igt_fork_helper(struct igt_helper_process *proc)
int id;
assert(!proc->running);
- assert(helper_process_count < NUM_HELPER_PROCS);
+ assert(helper_process_count < ARRAY_SIZE(helper_process_pids));
for (id = 0; helper_process_pids[id] != -1; id++)
;