[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/tty-child-frames 9accfc24bcd: Fix compilation warnings
From: |
Eli Zaretskii |
Subject: |
scratch/tty-child-frames 9accfc24bcd: Fix compilation warnings |
Date: |
Tue, 22 Oct 2024 04:57:06 -0400 (EDT) |
branch: scratch/tty-child-frames
commit 9accfc24bcd82087d936cf7ee37470f86cac8ea7
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix compilation warnings
* src/frame.c (tty_child_size_param):
* src/frame.h (MOUSE_HL_INFO): Avoid NULL dereference warnings.
---
src/frame.c | 16 +++++++++++-----
src/frame.h | 4 +---
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/frame.c b/src/frame.c
index 2b90d9b524c..6b7f04aed80 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -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))
diff --git a/src/frame.h b/src/frame.h
index 0b7368fb29b..9a9d025e638 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -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. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- scratch/tty-child-frames 9accfc24bcd: Fix compilation warnings,
Eli Zaretskii <=