diff src/gui_gtk_x11.c @ 24768:7334bf933510 v8.2.2922

patch 8.2.2922: computing array length is done in various ways Commit: https://github.com/vim/vim/commit/eeec2548785b2dd245a31ab25d7bde0f88ea1a6d Author: K.Takata <kentkt@csc.jp> Date: Wed Jun 2 13:28:16 2021 +0200 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 https://github.com/vim/vim/issues/8305)
author Bram Moolenaar <Bram@vim.org>
date Wed, 02 Jun 2021 13:30:05 +0200
parents 74f869d4bd54
children aade8ef975d5
line wrap: on
line diff
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -134,7 +134,7 @@ static const GtkTargetEntry selection_ta
     {"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 @@ static const GtkTargetEntry dnd_targets[
     {"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 @@ mch_set_mouse_shape(int shape)
 	    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;