[Spice-devel] [PATCH 2/3] use G_N_ELEMENTS instead of manually compute array size

Frediano Ziglio fziglio at redhat.com
Tue Feb 23 16:06:36 UTC 2016


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/reds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index 444d7ac..e58cec5 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -880,7 +880,7 @@ static const int secondary_channels[] = {
 static int channel_is_secondary(RedChannel *channel)
 {
     int i;
-    for (i = 0 ; i < sizeof(secondary_channels)/sizeof(secondary_channels[0]); ++i) {
+    for (i = 0 ; i < G_N_ELEMENTS(secondary_channels); ++i) {
         if (channel->type == secondary_channels[i]) {
             return TRUE;
         }
-- 
2.5.0



More information about the Spice-devel mailing list