patch 8.2.2922: computing array length is done in various ways
Problem: Computing array length is done in various ways.
Solution: Use ARRAY_LENGTH everywhere. (Ken Takata, closes #8305)
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 249b208..1a3eada 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -134,7 +134,7 @@
{"TEXT", 0, TARGET_TEXT},
{"STRING", 0, TARGET_STRING}
};
-#define N_SELECTION_TARGETS (sizeof(selection_targets) / sizeof(selection_targets[0]))
+#define N_SELECTION_TARGETS ARRAY_LENGTH(selection_targets)
#ifdef FEAT_DND
/*
@@ -149,7 +149,7 @@
{"STRING", 0, TARGET_STRING},
{"text/plain", 0, TARGET_TEXT_PLAIN}
};
-# define N_DND_TARGETS (sizeof(dnd_targets) / sizeof(dnd_targets[0]))
+# define N_DND_TARGETS ARRAY_LENGTH(dnd_targets)
#endif
@@ -6853,7 +6853,7 @@
else
id &= ~1; // they are always even (why?)
}
- else if (shape < (int)(sizeof(mshape_ids) / sizeof(int)))
+ else if (shape < (int)ARRAY_LENGTH(mshape_ids))
id = mshape_ids[shape];
else
return;