Skip to content

Commit

Permalink
Tweak x_hide_tip for consistency
Browse files Browse the repository at this point in the history
* src/xfns.c (x_hide_tip, Fx_show_tip): Be consistent about using
!NILP (tip_frame) instead of FRAMEP (tip_frame).  The two
expressions are logically equivalent since tip_frame is either a
frame or nil, !NILP is a bit faster, and making things consistent
pacifies gcc 11.2.1 -Wanalyzer-null-dereference.
  • Loading branch information
eggert committed Oct 4, 2021
1 parent 7e871dc commit 87153cc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/xfns.c
Expand Up @@ -6222,7 +6222,7 @@ Otherwise, the return value is a vector with the following fields:
static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object,
Lisp_Object, int, int, int *, int *);

/* The frame of the currently visible tooltip. */
/* The frame of the currently visible tooltip, or nil if none. */
static Lisp_Object tip_frame;

/* The window-system window corresponding to the frame of the
Expand Down Expand Up @@ -6710,7 +6710,7 @@ x_hide_tip (bool delete)
if ((NILP (tip_last_frame) && NILP (tip_frame))
|| (!x_gtk_use_system_tooltips
&& !delete
&& FRAMEP (tip_frame)
&& !NILP (tip_frame)
&& FRAME_LIVE_P (XFRAME (tip_frame))
&& !FRAME_VISIBLE_P (XFRAME (tip_frame))))
/* Either there's no tooltip to hide or it's an already invisible
Expand All @@ -6727,7 +6727,7 @@ x_hide_tip (bool delete)
specbind (Qinhibit_quit, Qt);

/* Try to hide the GTK+ system tip first. */
if (FRAMEP (tip_last_frame))
if (!NILP (tip_last_frame))
{
struct frame *f = XFRAME (tip_last_frame);

Expand All @@ -6745,7 +6745,7 @@ x_hide_tip (bool delete)
tip_last_frame = Qnil;

/* Now look whether there's an Emacs tip around. */
if (FRAMEP (tip_frame))
if (!NILP (tip_frame))
{
struct frame *f = XFRAME (tip_frame);

Expand Down Expand Up @@ -6775,7 +6775,7 @@ x_hide_tip (bool delete)
#else /* not USE_GTK */
if (NILP (tip_frame)
|| (!delete
&& FRAMEP (tip_frame)
&& !NILP (tip_frame)
&& FRAME_LIVE_P (XFRAME (tip_frame))
&& !FRAME_VISIBLE_P (XFRAME (tip_frame))))
return Qnil;
Expand All @@ -6788,7 +6788,7 @@ x_hide_tip (bool delete)
specbind (Qinhibit_redisplay, Qt);
specbind (Qinhibit_quit, Qt);

if (FRAMEP (tip_frame))
if (!NILP (tip_frame))
{
struct frame *f = XFRAME (tip_frame);

Expand Down Expand Up @@ -6931,7 +6931,7 @@ Text larger than the specified size is clipped. */)
}
#endif /* USE_GTK */

if (FRAMEP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame)))
if (!NILP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame)))
{
if (FRAME_VISIBLE_P (XFRAME (tip_frame))
&& EQ (frame, tip_last_frame)
Expand Down Expand Up @@ -7016,7 +7016,7 @@ Text larger than the specified size is clipped. */)
tip_last_string = string;
tip_last_parms = parms;

if (!FRAMEP (tip_frame) || !FRAME_LIVE_P (XFRAME (tip_frame)))
if (NILP (tip_frame) || !FRAME_LIVE_P (XFRAME (tip_frame)))
{
/* Add default values to frame parameters. */
if (NILP (Fassq (Qname, parms)))
Expand Down

0 comments on commit 87153cc

Please sign in to comment.