Fix compilation warnings

* src/frame.c (tty_child_size_param):
* src/frame.h (MOUSE_HL_INFO): Avoid NULL dereference warnings.
This commit is contained in:
Eli Zaretskii 2024-10-22 04:56:19 -04:00
parent 55af24a1c2
commit 9accfc24bc
2 changed files with 12 additions and 8 deletions

View 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))

View 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. */