From: weizhixiang Date: Mon, 30 Aug 2021 09:39:56 +0000 (+0900) Subject: use ARRAY_FOR_EACH when traverse array X-Git-Tag: 1.19.0~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d8088176149a6086927eb765a6e617cf0041ec10;p=platform%2Fupstream%2Flibinput.git use ARRAY_FOR_EACH when traverse array Signed-off-by: weizhixiang --- diff --git a/test/test-device.c b/test/test-device.c index 00728d33..2ff0fc9d 100644 --- a/test/test-device.c +++ b/test/test-device.c @@ -1448,7 +1448,7 @@ debug_log_handler(struct libinput *libinput, const char *format, va_list args) { - char *message; + char *message, **dmsg; int n; if (priority != LIBINPUT_LOG_PRIORITY_DEBUG) @@ -1457,9 +1457,9 @@ debug_log_handler(struct libinput *libinput, n = xvasprintf(&message, format, args); litest_assert_int_gt(n, 0); - for (size_t idx = 0; idx < ARRAY_LENGTH(debug_messages); idx++) { - if (debug_messages[idx] == NULL) { - debug_messages[idx] = message; + ARRAY_FOR_EACH(debug_messages, dmsg) { + if (*dmsg == NULL) { + *dmsg = message; return; } }