]> git.eshelyaron.com Git - emacs.git/commitdiff
Pacify gcc 10.2 -Wanalyzer-null-argument in gtkutil.c
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 25 Dec 2020 08:27:37 +0000 (00:27 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 25 Dec 2020 09:40:39 +0000 (01:40 -0800)
* src/gtkutil.c (xg_item_label_same_p): Simplify.  Without this
simplification, GCC (Ubuntu 10.2.0-13ubuntu1)
-Wanalyzer-null-argument complains about use of NULL where
non-null expected as argument of strcmp.

src/gtkutil.c

index fafd94c0f710821834d37eefaaabab44443d1f1d..807ee17fa30247618cd878681d4677122fb17d74 100644 (file)
@@ -2944,14 +2944,11 @@ xg_get_menu_item_label (GtkMenuItem *witem)
 static bool
 xg_item_label_same_p (GtkMenuItem *witem, const char *label)
 {
-  bool is_same = 0;
   char *utf8_label = get_utf8_string (label);
   const char *old_label = witem ? xg_get_menu_item_label (witem) : 0;
 
-  if (! old_label && ! utf8_label)
-    is_same = 1;
-  else if (old_label && utf8_label)
-    is_same = strcmp (utf8_label, old_label) == 0;
+  bool is_same = (!old_label == !utf8_label
+                 && (!old_label || strcmp (utf8_label, old_label) == 0));
 
   if (utf8_label) g_free (utf8_label);