]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix compilation warnings
authorEli Zaretskii <eliz@gnu.org>
Tue, 22 Oct 2024 08:56:19 +0000 (04:56 -0400)
committerEshel Yaron <me@eshelyaron.com>
Mon, 23 Dec 2024 14:50:49 +0000 (15:50 +0100)
* src/frame.c (tty_child_size_param):
* src/frame.h (MOUSE_HL_INFO): Avoid NULL dereference warnings.

(cherry picked from commit 9accfc24bcd82087d936cf7ee37470f86cac8ea7)

src/frame.c
src/frame.h

index e7d9ecbb0dddf0e23d6dbeef925fc487bb964459..cbae89aea716cd1a5d9fc652d47d020203a7b910 100644 (file)
@@ -1428,7 +1428,7 @@ tty_child_size_param (struct frame *child, Lisp_Object key,
       if (CONSP (val))
        {
          /* Width and height may look like (width text-pixels
-            . PIXELS) on window systems. Mimic that. */
+            . PIXELS) on window systems.  Mimic that.  */
          val = XCDR (val);
          if (EQ (val, Qtext_pixels))
            val = XCDR (val);
@@ -1436,11 +1436,17 @@ tty_child_size_param (struct frame *child, Lisp_Object key,
       else if (FLOATP (val))
        {
          /* Width and height may be a float, in which case
-            it's a multiple of the parent's value. */
+            it's a multiple of the parent's value.  */
          struct frame *parent = FRAME_PARENT_FRAME (child);
-         int sz = (EQ (key, Qwidth) ? FRAME_TOTAL_COLS (parent)
-                   : FRAME_TOTAL_LINES (parent));
-         val = make_fixnum (XFLOAT_DATA (val) * sz);
+         eassert (parent);     /* the caller ensures this, but... */
+         if (parent)
+           {
+             int sz = (EQ (key, Qwidth) ? FRAME_TOTAL_COLS (parent)
+                       : FRAME_TOTAL_LINES (parent));
+             val = make_fixnum (XFLOAT_DATA (val) * sz);
+           }
+         else
+           val = Qnil;
        }
 
       if (FIXNATP (val))
index 0b7368fb29be623d9d9ba00696d9463304dfbe91..9a9d025e6384471d660c20e0b59d8642e7c33b5d 100644 (file)
@@ -1018,9 +1018,7 @@ default_pixels_per_inch_y (void)
 #ifndef HAVE_ANDROID
 #   define MOUSE_HL_INFO(F)                                    \
   (FRAME_WINDOW_P (F)                                          \
-  ? (FRAME_OUTPUT_DATA (F)                                     \
-     ? &FRAME_DISPLAY_INFO (F)->mouse_highlight                        \
-     : NULL)                                                   \
+   ? &FRAME_DISPLAY_INFO (F)->mouse_highlight                  \
    : &(F)->output_data.tty->display_info->mouse_highlight)
 #else
 /* There is no "struct tty_output" on Android at all.  */