diff src/highlight.c @ 27752:c1d1639b52dd v8.2.4402

patch 8.2.4402: missing parenthesis may cause unexpected problems Commit: https://github.com/vim/vim/commit/ae6f1d8b14c2f63811ee83ef14e32086fb3e9b83 Author: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Wed Feb 16 19:24:07 2022 +0000 patch 8.2.4402: missing parenthesis may cause unexpected problems Problem: Missing parenthesis may cause unexpected problems. Solution: Add more parenthesis is macros. (closes https://github.com/vim/vim/issues/9788)
author Bram Moolenaar <Bram@vim.org>
date Wed, 16 Feb 2022 20:30:03 +0100
parents 18cafa092e8d
children 62cc3b60493b
line wrap: on
line diff
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -29,7 +29,7 @@ static char *(hl_name_table[]) =
       "italic", "reverse", "inverse", "nocombine", "strikethrough", "NONE"};
 static int hl_attr_table[] =
     {HL_BOLD, HL_STANDOUT, HL_UNDERLINE, HL_UNDERCURL, HL_ITALIC, HL_INVERSE, HL_INVERSE, HL_NOCOMBINE, HL_STRIKETHROUGH, 0};
-#define ATTR_COMBINE(attr_a, attr_b) ((((attr_b) & HL_NOCOMBINE) ? attr_b : (attr_a)) | (attr_b))
+#define ATTR_COMBINE(attr_a, attr_b) ((((attr_b) & HL_NOCOMBINE) ? (attr_b) : (attr_a)) | (attr_b))
 
 /*
  * Structure that stores information about a highlight group.
@@ -2260,7 +2260,7 @@ color_name2handle(char_u *name)
 #  undef RGB
 # endif
 # ifndef RGB
-#  define RGB(r, g, b)	((r<<16) | (g<<8) | (b))
+#  define RGB(r, g, b)	(((r)<<16) | ((g)<<8) | (b))
 # endif
 
 # ifdef VIMDLL