emacs-devel
[Top][All Lists]
Advanced

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

Re: FACE_FROM_ID vs FACE_OPT_FROM_ID


From: Paul Eggert
Subject: Re: FACE_FROM_ID vs FACE_OPT_FROM_ID
Date: Fri, 24 Jun 2016 02:23:17 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

On 06/23/2016 10:03 PM, Eli Zaretskii wrote:
What was the GCC 6.1 complaint that led you to this change?
Diagnostics like this one (there were quite a few):

xdisp.c: In function 'fill_image_glyph_string':
xdisp.c:24916:20: error: potential null pointer dereference [-Werror=null-dereference]
   s->font = s->face->font;
             ~~~~~~~^~~~~~

The problem being that s->face was set from FACE_FROM_ID, which (before the change) might return a null pointer.

The intent is that FACE_FROM_ID returns a face (a non-null pointer), whereas FACE_OPT_FROM_ID returns a face option (either a face or a null pointer). Similarly for IMAGE_FROM_ID. I installed the attached patch to try to make this clearer.

Attachment: 0001-Clarify-intent-of-FACE_FROM_ID-and-IMAGE_FROM_ID.txt
Description: Text document


reply via email to

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