emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/gnus-cloud 2f7e8fa 01/15: Merge branch 'master' of


From: Teodor Zlatanov
Subject: [Emacs-diffs] scratch/gnus-cloud 2f7e8fa 01/15: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Tue, 5 Jul 2016 02:22:47 +0000 (UTC)

branch: scratch/gnus-cloud
commit 2f7e8faacb12b12b5b46b99df43cfbf03a65d3bd
Merge: 1a30c81 55d38fc
Author: Ted Zlatanov <address@hidden>
Commit: Ted Zlatanov <address@hidden>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 src/alloc.c      |    2 +-
 src/dispextern.h |    2 +-
 src/fontset.c    |    4 ++--
 src/fringe.c     |    5 ++---
 src/macfont.m    |    4 ++--
 src/msdos.c      |    6 +++---
 src/nsfont.m     |    3 ++-
 src/nsterm.h     |    2 +-
 src/nsterm.m     |   22 ++++++++++++----------
 src/w32console.c |    2 --
 src/w32term.c    |   10 +++++-----
 src/xdisp.c      |   48 +++++++++++++++++++++++-------------------------
 src/xfaces.c     |   31 +++++++++++++++----------------
 src/xterm.c      |   10 +++++-----
 14 files changed, 74 insertions(+), 77 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index 5f9d6ad..e25d91f 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6135,7 +6135,7 @@ mark_face_cache (struct face_cache *c)
       int i, j;
       for (i = 0; i < c->used; ++i)
        {
-         struct face *face = FACE_OPT_FROM_ID (c->f, i);
+         struct face *face = FACE_FROM_ID_OR_NULL (c->f, i);
 
          if (face)
            {
diff --git a/src/dispextern.h b/src/dispextern.h
index 08dcd89..1325ff9 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1821,7 +1821,7 @@ struct face_cache
 /* Return a pointer to the face with ID on frame F, or null if such a
    face doesn't exist.  */
 
-#define FACE_OPT_FROM_ID(F, ID)                                \
+#define FACE_FROM_ID_OR_NULL(F, ID)                    \
   (UNSIGNED_CMP (ID, <, FRAME_FACE_CACHE (F)->used)    \
    ? FRAME_FACE_CACHE (F)->faces_by_id[ID]             \
    : NULL)
diff --git a/src/fontset.c b/src/fontset.c
index 81528de..67696d0 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1305,7 +1305,7 @@ free_realized_fontsets (Lisp_Object base)
            {
              struct frame *f = XFRAME (FONTSET_FRAME (this));
              int face_id = XINT (XCDR (XCAR (tail)));
-             struct face *face = FACE_OPT_FROM_ID (f, face_id);
+             struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
 
              /* Face THIS itself is also freed by the following call.  */
              free_realized_face (f, face);
@@ -1637,7 +1637,7 @@ appended.  By default, FONT-SPEC overrides the previous 
settings.  */)
            continue;
          if (fontset_id != FRAME_FONTSET (f))
            continue;
-         face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
+         face = FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID);
          if (face)
            font_object = font_load_for_lface (f, face->lface, font_spec);
          else
diff --git a/src/fringe.c b/src/fringe.c
index 87ec9d1..986bde1 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -620,8 +620,7 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row 
*row, int left_p, int o
       break;
     }
 
-  p.face = FACE_OPT_FROM_ID (f, face_id);
-
+  p.face = FACE_FROM_ID_OR_NULL (f, face_id);
   if (p.face == NULL)
     {
       /* This could happen after clearing face cache.
@@ -1627,7 +1626,7 @@ If FACE is nil, reset face to default fringe face.  */)
     {
       struct frame *f = SELECTED_FRAME ();
 
-      if (FACE_OPT_FROM_ID (f, FRINGE_FACE_ID)
+      if (FACE_FROM_ID_OR_NULL (f, FRINGE_FACE_ID)
          && lookup_derived_face (f, face, FRINGE_FACE_ID, 1) < 0)
        error ("No such face");
     }
diff --git a/src/macfont.m b/src/macfont.m
index 7900134..4e4daba 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -2856,8 +2856,8 @@ macfont_draw (struct glyph_string *s, int from, int to, 
int x, int y,
     {
       if (s->hl == DRAW_MOUSE_FACE)
         {
-          face = FACE_OPT_FROM_ID (s->f,
-                                  MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+          face = FACE_FROM_ID_OR_NULL (s->f,
+                                      MOUSE_HL_INFO 
(s->f)->mouse_face_face_id);
           if (!face)
             face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
         }
diff --git a/src/msdos.c b/src/msdos.c
index c2b19a6..73d755a 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -795,8 +795,8 @@ static void
 IT_set_face (int face)
 {
   struct frame *sf = SELECTED_FRAME ();
-  struct face *fp  = FACE_OPT_FROM_ID (sf, face);
-  struct face *dfp = FACE_OPT_FROM_ID (sf, DEFAULT_FACE_ID);
+  struct face *fp  = FACE_FROM_ID_OR_NULL (sf, face);
+  struct face *dfp = FACE_FROM_ID_OR_NULL (sf, DEFAULT_FACE_ID);
   unsigned long fg, bg, dflt_fg, dflt_bg;
   struct tty_display_info *tty = FRAME_TTY (sf);
 
@@ -1076,7 +1076,7 @@ IT_clear_screen (struct frame *f)
      any valid faces and will abort.  Instead, use the initial screen
      colors; that should mimic what a Unix tty does, which simply clears
      the screen with whatever default colors are in use.  */
-  if (FACE_OPT_FROM_ID (SELECTED_FRAME (), DEFAULT_FACE_ID) == NULL)
+  if (FACE_FROM_ID_OR_NULL (SELECTED_FRAME (), DEFAULT_FACE_ID) == NULL)
     ScreenAttrib = (initial_screen_colors[0] << 4) | initial_screen_colors[1];
   else
     IT_set_face (0);
diff --git a/src/nsfont.m b/src/nsfont.m
index 7c97c6f..569a69f 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -1071,7 +1071,8 @@ nsfont_draw (struct glyph_string *s, int from, int to, 
int x, int y,
       face = s->face;
       break;
     case NS_DUMPGLYPH_MOUSEFACE:
-      face = FACE_OPT_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+      face = FACE_FROM_ID_OR_NULL (s->f,
+                                  MOUSE_HL_INFO (s->f)->mouse_face_face_id);
       if (!face)
         face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
       break;
diff --git a/src/nsterm.h b/src/nsterm.h
index c2285c9..862ff2e 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1014,7 +1014,7 @@ struct x_output
 #define FRAME_NS_TITLEBAR_HEIGHT(f) ((f)->output_data.ns->titlebar_height)
 #define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.ns->toolbar_height)
 
-#define FRAME_DEFAULT_FACE(f) FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID)
+#define FRAME_DEFAULT_FACE(f) FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID)
 
 #define FRAME_NS_VIEW(f) ((f)->output_data.ns->view)
 #define FRAME_CURSOR_COLOR(f) ((f)->output_data.ns->cursor_color)
diff --git a/src/nsterm.m b/src/nsterm.m
index 4b887ec..4027f5c 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2882,7 +2882,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row 
*glyph_row,
   ns_clip_to_row (w, glyph_row, TEXT_AREA, NO); /* do ns_focus(f, &r, 1); if 
remove */
 
 
-  face = FACE_OPT_FROM_ID (f, phys_cursor_glyph->face_id);
+  face = FACE_FROM_ID_OR_NULL (f, phys_cursor_glyph->face_id);
   if (face && NS_FACE_BACKGROUND (face)
       == ns_index_color (FRAME_CURSOR_COLOR (f), f))
     {
@@ -2954,7 +2954,7 @@ ns_draw_vertical_window_border (struct window *w, int x, 
int y0, int y1)
 
   NSTRACE ("ns_draw_vertical_window_border");
 
-  face = FACE_OPT_FROM_ID (f, VERTICAL_BORDER_FACE_ID);
+  face = FACE_FROM_ID_OR_NULL (f, VERTICAL_BORDER_FACE_ID);
 
   ns_focus (f, &r, 1);
   if (face)
@@ -2977,7 +2977,7 @@ ns_draw_window_divider (struct window *w, int x0, int x1, 
int y0, int y1)
 
   NSTRACE ("ns_draw_window_divider");
 
-  face = FACE_OPT_FROM_ID (f, WINDOW_DIVIDER_FACE_ID);
+  face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID);
 
   ns_focus (f, &r, 1);
   if (face)
@@ -3311,9 +3311,10 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s)
 
   if (s->hl == DRAW_MOUSE_FACE)
     {
-      face = FACE_OPT_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+      face = FACE_FROM_ID_OR_NULL (s->f,
+                                  MOUSE_HL_INFO (s->f)->mouse_face_face_id);
       if (!face)
-        face = FACE_OPT_FROM_ID (s->f, MOUSE_FACE_ID);
+        face = FACE_FROM_ID_OR_NULL (s->f, MOUSE_FACE_ID);
     }
   else
     face = s->face;
@@ -3379,8 +3380,8 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, 
char force_p)
           if (s->hl == DRAW_MOUSE_FACE)
             {
               face
-               = FACE_OPT_FROM_ID (s->f,
-                                   MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+               = FACE_FROM_ID_OR_NULL (s->f,
+                                       MOUSE_HL_INFO 
(s->f)->mouse_face_face_id);
               if (!face)
                 face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
             }
@@ -3446,7 +3447,8 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
      with its background color), we must clear just the image area. */
   if (s->hl == DRAW_MOUSE_FACE)
     {
-      face = FACE_OPT_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+      face = FACE_FROM_ID_OR_NULL (s->f,
+                                  MOUSE_HL_INFO (s->f)->mouse_face_face_id);
       if (!face)
        face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
     }
@@ -3563,8 +3565,8 @@ ns_dumpglyphs_stretch (struct glyph_string *s)
 
       if (s->hl == DRAW_MOUSE_FACE)
        {
-         face = FACE_OPT_FROM_ID (s->f,
-                                 MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+         face = FACE_FROM_ID_OR_NULL (s->f,
+                                     MOUSE_HL_INFO (s->f)->mouse_face_face_id);
          if (!face)
            face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
        }
diff --git a/src/w32console.c b/src/w32console.c
index 98343a6..c71afb6 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -611,8 +611,6 @@ w32_face_attributes (struct frame *f, int face_id)
   WORD char_attr;
   struct face *face = FACE_FROM_ID (f, face_id);
 
-  eassert (face != NULL);
-
   char_attr = char_attr_normal;
 
   /* Reverse the default color if requested. If background and
diff --git a/src/w32term.c b/src/w32term.c
index 7ef3407..5a11e2a 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -611,7 +611,7 @@ w32_draw_vertical_window_border (struct window *w, int x, 
int y0, int y1)
   r.bottom = y1;
 
   hdc = get_frame_dc (f);
-  face = FACE_OPT_FROM_ID (f, VERTICAL_BORDER_FACE_ID);
+  face = FACE_FROM_ID_OR_NULL (f, VERTICAL_BORDER_FACE_ID);
   if (face)
     w32_fill_rect (f, hdc, face->foreground, &r);
   else
@@ -628,11 +628,11 @@ w32_draw_window_divider (struct window *w, int x0, int 
x1, int y0, int y1)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   HDC hdc = get_frame_dc (f);
-  struct face *face = FACE_OPT_FROM_ID (f, WINDOW_DIVIDER_FACE_ID);
+  struct face *face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID);
   struct face *face_first
-    = FACE_OPT_FROM_ID (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID);
+    = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID);
   struct face *face_last
-    = FACE_OPT_FROM_ID (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID);
+    = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID);
   unsigned long color = face ? face->foreground : FRAME_FOREGROUND_PIXEL (f);
   unsigned long color_first = (face_first
                               ? face_first->foreground
@@ -991,7 +991,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
 
   /* What face has to be used last for the mouse face?  */
   face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id;
-  face = FACE_OPT_FROM_ID (s->f, face_id);
+  face = FACE_FROM_ID_OR_NULL (s->f, face_id);
   if (face == NULL)
     face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
 
diff --git a/src/xdisp.c b/src/xdisp.c
index 1289515..2d0d677 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1813,7 +1813,7 @@ estimate_mode_line_height (struct frame *f, enum face_id 
face_id)
         cache and mode line face are not yet initialized.  */
       if (FRAME_FACE_CACHE (f))
        {
-         struct face *face = FACE_OPT_FROM_ID (f, face_id);
+         struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
          if (face)
            {
              if (face->font)
@@ -2918,7 +2918,7 @@ init_iterator (struct it *it, struct window *w,
 
       /* If we have a boxed mode line, make the first character appear
         with a left box line.  */
-      face = FACE_OPT_FROM_ID (it->f, remapped_base_face_id);
+      face = FACE_FROM_ID_OR_NULL (it->f, remapped_base_face_id);
       if (face && face->box != FACE_NO_BOX)
        it->start_of_box_run_p = true;
     }
@@ -3877,9 +3877,9 @@ handle_face_prop (struct it *it)
        {
          struct face *new_face = FACE_FROM_ID (it->f, new_face_id);
          /* If it->face_id is -1, old_face below will be NULL, see
-            the definition of FACE_OPT_FROM_ID.  This will happen if this
-            is the initial call that gets the face.  */
-         struct face *old_face = FACE_OPT_FROM_ID (it->f, it->face_id);
+            the definition of FACE_FROM_ID_OR_NULL.  This will happen
+            if this is the initial call that gets the face.  */
+         struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
 
          /* If the value of face_id of the iterator is -1, we have to
             look in front of IT's position and see whether there is a
@@ -3888,7 +3888,7 @@ handle_face_prop (struct it *it)
            {
              int prev_face_id = face_before_it_pos (it);
 
-             old_face = FACE_OPT_FROM_ID (it->f, prev_face_id);
+             old_face = FACE_FROM_ID_OR_NULL (it->f, prev_face_id);
            }
 
          /* If the new face has a box, but the old face does not,
@@ -3988,7 +3988,7 @@ handle_face_prop (struct it *it)
       if (new_face_id != it->face_id)
        {
          struct face *new_face = FACE_FROM_ID (it->f, new_face_id);
-         struct face *old_face = FACE_OPT_FROM_ID (it->f, it->face_id);
+         struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
 
          /* If new face has a box but old face hasn't, this is the
             start of a run of characters with box, i.e. it has a
@@ -6095,7 +6095,7 @@ pop_it (struct it *it)
       break;
     case GET_FROM_STRING:
       {
-       struct face *face = FACE_OPT_FROM_ID (it->f, it->face_id);
+       struct face *face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
 
        /* Restore the face_box_p flag, since it could have been
           overwritten by the face of the object that we just finished
@@ -6776,7 +6776,8 @@ static next_element_function const 
get_next_element[NUM_IT_METHODS] =
    || ((IT)->cmp_it.stop_pos == (CHARPOS)                              \
        && composition_reseat_it (&(IT)->cmp_it, CHARPOS, BYTEPOS,      \
                                 END_CHARPOS, (IT)->w,                  \
-                                FACE_OPT_FROM_ID ((IT)->f, (IT)->face_id),     
\
+                                FACE_FROM_ID_OR_NULL ((IT)->f,         \
+                                                      (IT)->face_id),  \
                                 (IT)->string)))
 
 
@@ -7205,7 +7206,7 @@ get_next_display_element (struct it *it)
       if (it->method == GET_FROM_STRING && it->sp)
        {
          int face_id = underlying_face_id (it);
-         struct face *face = FACE_OPT_FROM_ID (it->f, face_id);
+         struct face *face = FACE_FROM_ID_OR_NULL (it->f, face_id);
 
          if (face)
            {
@@ -7738,8 +7739,8 @@ next_element_from_display_vector (struct it *it)
       /* Glyphs in the display vector could have the box face, so we
         need to set the related flags in the iterator, as
         appropriate.  */
-      this_face = FACE_OPT_FROM_ID (it->f, it->face_id);
-      prev_face = FACE_OPT_FROM_ID (it->f, prev_face_id);
+      this_face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
+      prev_face = FACE_FROM_ID_OR_NULL (it->f, prev_face_id);
 
       /* Is this character the first character of a box-face run?  */
       it->start_of_box_run_p = (this_face && this_face->box != FACE_NO_BOX
@@ -7764,7 +7765,7 @@ next_element_from_display_vector (struct it *it)
                                            it->saved_face_id);
            }
        }
-      next_face = FACE_OPT_FROM_ID (it->f, next_face_id);
+      next_face = FACE_FROM_ID_OR_NULL (it->f, next_face_id);
       it->end_of_box_run_p = (this_face && this_face->box != FACE_NO_BOX
                              && (!next_face
                                  || next_face->box == FACE_NO_BOX));
@@ -19675,14 +19676,15 @@ extend_face_to_end_of_line (struct it *it)
     return;
 
   /* The default face, possibly remapped. */
-  default_face = FACE_OPT_FROM_ID (f, lookup_basic_face (f, DEFAULT_FACE_ID));
+  default_face = FACE_FROM_ID_OR_NULL (f,
+                                      lookup_basic_face (f, DEFAULT_FACE_ID));
 
   /* Face extension extends the background and box of IT->face_id
      to the end of the line.  If the background equals the background
      of the frame, we don't have to do anything.  */
-  face = FACE_OPT_FROM_ID (f, (it->face_before_selective_p
-                              ? it->saved_face_id
-                              : it->face_id));
+  face = FACE_FROM_ID (f, (it->face_before_selective_p
+                          ? it->saved_face_id
+                          : it->face_id));
 
   if (FRAME_WINDOW_P (f)
       && MATRIX_ROW_DISPLAYS_TEXT_P (it->glyph_row)
@@ -24784,7 +24786,7 @@ fill_gstring_glyph_string (struct glyph_string *s, int 
face_id,
   s->cmp_id = glyph->u.cmp.id;
   s->cmp_from = glyph->slice.cmp.from;
   s->cmp_to = glyph->slice.cmp.to + 1;
-  s->face = FACE_OPT_FROM_ID (s->f, face_id);
+  s->face = FACE_FROM_ID (s->f, face_id);
   lgstring = composition_gstring_from_id (s->cmp_id);
   s->font = XFONT_OBJECT (LGSTRING_FONT (lgstring));
   glyph++;
@@ -25377,7 +25379,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, 
bool backward_p)
 #define BUILD_COMPOSITE_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \
   do {                                                                     \
     int face_id = (row)->glyphs[area][START].face_id;                      \
-    struct face *base_face = FACE_OPT_FROM_ID (f, face_id);                \
+    struct face *base_face = FACE_FROM_ID (f, face_id);                    \
     ptrdiff_t cmp_id = (row)->glyphs[area][START].u.cmp.id;                \
     struct composition *cmp = composition_table[cmp_id];                   \
     XChar2b *char2b;                                                       \
@@ -26694,12 +26696,8 @@ calc_line_height_property (struct it *it, Lisp_Object 
val, struct font *font,
       struct face *face;
 
       face_id = lookup_named_face (it->f, face_name, false);
-      if (face_id < 0)
-       return make_number (-1);
-
-      face = FACE_FROM_ID (it->f, face_id);
-      font = face->font;
-      if (font == NULL)
+      face = FACE_FROM_ID_OR_NULL (it->f, face_id);
+      if (face == NULL || ((font = face->font) == NULL))
        return make_number (-1);
       boff = font->baseline_offset;
       if (font->vertical_centering)
diff --git a/src/xfaces.c b/src/xfaces.c
index 97a5ae0..0a1315d 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1552,9 +1552,7 @@ the WIDTH times as wide as FACE on FRAME.  */)
       /* This is of limited utility since it works with character
         widths.  Keep it for compatibility.  --gerd.  */
       int face_id = lookup_named_face (f, face, false);
-      struct face *width_face = (face_id < 0
-                                ? NULL
-                                : FACE_FROM_ID (f, face_id));
+      struct face *width_face = FACE_FROM_ID_OR_NULL (f, face_id);
 
       if (width_face && width_face->font)
        {
@@ -3694,7 +3692,7 @@ Default face attributes override any local face 
attributes.  */)
   if (EQ (face, Qdefault))
     {
       struct face_cache *c = FRAME_FACE_CACHE (f);
-      struct face *newface, *oldface = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
+      struct face *newface, *oldface = FACE_FROM_ID_OR_NULL (f, 
DEFAULT_FACE_ID);
       Lisp_Object attrs[LFACE_VECTOR_SIZE];
 
       /* This can be NULL (e.g., in batch mode).  */
@@ -3777,7 +3775,7 @@ return the font name used for CHARACTER.  */)
     {
       struct frame *f = decode_live_frame (frame);
       int face_id = lookup_named_face (f, face, true);
-      struct face *fface = FACE_OPT_FROM_ID (f, face_id);
+      struct face *fface = FACE_FROM_ID_OR_NULL (f, face_id);
 
       if (! fface)
        return Qnil;
@@ -3786,9 +3784,9 @@ return the font name used for CHARACTER.  */)
        {
          CHECK_CHARACTER (character);
          face_id = FACE_FOR_CHAR (f, fface, XINT (character), -1, Qnil);
-         fface = FACE_FROM_ID (f, face_id);
+         fface = FACE_FROM_ID_OR_NULL (f, face_id);
        }
-      return (fface->font
+      return ((fface && fface->font)
              ? fface->font->props[FONT_NAME_INDEX]
              : Qnil);
 #else  /* !HAVE_WINDOW_SYSTEM */
@@ -4376,7 +4374,7 @@ lookup_face (struct frame *f, Lisp_Object *attr)
     face = realize_face (cache, attr, -1);
 
 #ifdef GLYPH_DEBUG
-  eassert (face == FACE_FROM_ID (f, face->id));
+  eassert (face == FACE_FROM_ID_OR_NULL (f, face->id));
 #endif /* GLYPH_DEBUG */
 
   return face->id;
@@ -4429,7 +4427,7 @@ lookup_named_face (struct frame *f, Lisp_Object symbol, 
bool signal_p)
 {
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
   Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
-  struct face *default_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
+  struct face *default_face = FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID);
 
   if (default_face == NULL)
     {
@@ -4596,11 +4594,12 @@ lookup_derived_face (struct frame *f, Lisp_Object 
symbol, int face_id,
 {
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
   Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
-  struct face *default_face = FACE_FROM_ID (f, face_id);
+  struct face *default_face;
 
   if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0))
     return -1;
 
+  default_face = FACE_FROM_ID (f, face_id);
   memcpy (attrs, default_face->lface, sizeof attrs);
   merge_face_vectors (f, symbol_attrs, attrs, 0);
   return lookup_face (f, attrs);
@@ -4701,7 +4700,7 @@ x_supports_face_attributes_p (struct frame *f,
       merge_face_vectors (f, attrs, merged_attrs, 0);
 
       face_id = lookup_face (f, merged_attrs);
-      face = FACE_OPT_FROM_ID (f, face_id);
+      face = FACE_FROM_ID_OR_NULL (f, face_id);
 
       if (! face)
        error ("Cannot make face");
@@ -4971,7 +4970,7 @@ face for italic.  */)
     attrs[i] = Qunspecified;
   merge_face_ref (f, attributes, attrs, true, 0);
 
-  def_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
+  def_face = FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID);
   if (def_face == NULL)
     {
       if (! realize_basic_faces (f))
@@ -5445,7 +5444,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object 
attrs[LFACE_VECTOR_SIZE])
 
   /* Determine the font to use.  Most of the time, the font will be
      the same as the font of the default face, so try that first.  */
-  default_face = FACE_OPT_FROM_ID (f, DEFAULT_FACE_ID);
+  default_face = FACE_FROM_ID_OR_NULL (f, DEFAULT_FACE_ID);
   if (default_face
       && lface_same_font_attributes_p (default_face->lface, attrs))
     {
@@ -6131,7 +6130,7 @@ merge_faces (struct frame *f, Lisp_Object face_name, int 
face_id,
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
   struct face *base_face;
 
-  base_face = FACE_OPT_FROM_ID (f, base_face_id);
+  base_face = FACE_FROM_ID_OR_NULL (f, base_face_id);
   if (!base_face)
     return base_face_id;
 
@@ -6159,7 +6158,7 @@ merge_faces (struct frame *f, Lisp_Object face_name, int 
face_id,
       struct face *face;
       if (face_id < 0)
        return base_face_id;
-      face = FACE_OPT_FROM_ID (f, face_id);
+      face = FACE_FROM_ID_OR_NULL (f, face_id);
       if (!face)
        return base_face_id;
       merge_face_vectors (f, face->lface, attrs, 0);
@@ -6279,7 +6278,7 @@ DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, doc: 
/* */)
     {
       struct face *face;
       CHECK_NUMBER (n);
-      face = FACE_OPT_FROM_ID (SELECTED_FRAME (), XINT (n));
+      face = FACE_FROM_ID_OR_NULL (SELECTED_FRAME (), XINT (n));
       if (face == NULL)
        error ("Not a valid face");
       dump_realized_face (face);
diff --git a/src/xterm.c b/src/xterm.c
index 9fb19a1..76b92df 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1062,7 +1062,7 @@ x_draw_vertical_window_border (struct window *w, int x, 
int y0, int y1)
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   struct face *face;
 
-  face = FACE_OPT_FROM_ID (f, VERTICAL_BORDER_FACE_ID);
+  face = FACE_FROM_ID_OR_NULL (f, VERTICAL_BORDER_FACE_ID);
   if (face)
     XSetForeground (FRAME_X_DISPLAY (f), f->output_data.x->normal_gc,
                    face->foreground);
@@ -1081,11 +1081,11 @@ static void
 x_draw_window_divider (struct window *w, int x0, int x1, int y0, int y1)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
-  struct face *face = FACE_OPT_FROM_ID (f, WINDOW_DIVIDER_FACE_ID);
+  struct face *face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID);
   struct face *face_first
-    = FACE_OPT_FROM_ID (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID);
+    = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID);
   struct face *face_last
-    = FACE_OPT_FROM_ID (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID);
+    = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_LAST_PIXEL_FACE_ID);
   unsigned long color = face ? face->foreground : FRAME_FOREGROUND_PIXEL (f);
   unsigned long color_first = (face_first
                               ? face_first->foreground
@@ -1507,7 +1507,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
 
   /* What face has to be used last for the mouse face?  */
   face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id;
-  face = FACE_OPT_FROM_ID (s->f, face_id);
+  face = FACE_FROM_ID_OR_NULL (s->f, face_id);
   if (face == NULL)
     face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
 



reply via email to

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