emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 3b29afa 3/3: Pacify GCC 11.1.1 20210531 (Red Hat 11.1.1-3)


From: Paul Eggert
Subject: master 3b29afa 3/3: Pacify GCC 11.1.1 20210531 (Red Hat 11.1.1-3)
Date: Sun, 11 Jul 2021 04:30:18 -0400 (EDT)

branch: master
commit 3b29afa68070f3040f08fec0077213f9a15d1adc
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Pacify GCC 11.1.1 20210531 (Red Hat 11.1.1-3)
    
    * src/image.c (xpm_load_image):
    * src/xfns.c (x_icon):
    Rework to pacify gcc -Wmaybe-uninitialized.
---
 src/image.c |  4 ++--
 src/xfns.c  | 10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/image.c b/src/image.c
index 07de4d3..e2f3220 100644
--- a/src/image.c
+++ b/src/image.c
@@ -4991,7 +4991,7 @@ xpm_load_image (struct frame *f,
 
   while (num_colors-- > 0)
     {
-      char *color, *max_color;
+      char *color, *max_color = NULL;
       int key, next_key, max_key = 0;
       Lisp_Object symbol_color = Qnil, color_val;
       Emacs_Color cdef;
@@ -5052,7 +5052,7 @@ xpm_load_image (struct frame *f,
                                                   cdef.blue));
            }
        }
-      if (NILP (color_val) && max_key > 0)
+      if (NILP (color_val) && max_color)
        {
          if (xstrcasecmp (max_color, "None") == 0)
            color_val = Qt;
diff --git a/src/xfns.c b/src/xfns.c
index e46616e..81349d0 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3361,17 +3361,19 @@ x_icon (struct frame *f, Lisp_Object parms)
     = gui_frame_get_and_record_arg (f, parms, Qicon_top, 0, 0, 
RES_TYPE_NUMBER);
   int icon_xval, icon_yval;
 
-  if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
+  bool xgiven = !EQ (icon_x, Qunbound);
+  bool ygiven = !EQ (icon_y, Qunbound);
+  if (xgiven != ygiven)
+    error ("Both left and top icon corners of icon must be specified");
+  if (xgiven)
     {
       icon_xval = check_integer_range (icon_x, INT_MIN, INT_MAX);
       icon_yval = check_integer_range (icon_y, INT_MIN, INT_MAX);
     }
-  else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
-    error ("Both left and top icon corners of icon must be specified");
 
   block_input ();
 
-  if (! EQ (icon_x, Qunbound))
+  if (xgiven)
     x_wm_set_icon_position (f, icon_xval, icon_yval);
 
 #if false /* gui_display_get_arg removes the visibility parameter as a



reply via email to

[Prev in Thread] Current Thread [Next in Thread]