aboutsummaryrefslogtreecommitdiffstats
path: root/src/font.h
diff options
context:
space:
mode:
authorEli Zaretskii2015-11-24 18:08:39 +0200
committerEli Zaretskii2015-11-24 18:08:39 +0200
commitd5fdffecdfad305d9c933ae3cad75a5e4e73878c (patch)
tree91c34e1102fdd828c530dabb342eae7c796bd748 /src/font.h
parenta67cc630db28cf734d0e47f231add30c782bd8cf (diff)
downloademacs-d5fdffecdfad305d9c933ae3cad75a5e4e73878c.tar.gz
emacs-d5fdffecdfad305d9c933ae3cad75a5e4e73878c.zip
Fix crash at startup related to GC of font entities
* src/font.h (GC_FONT_SPEC_P, GC_FONT_ENTITY_P) (GC_FONT_OBJECT_P, GC_XFONT_SPEC, GC_XFONT_ENTITY) (GC_XFONT_OBJECT): New macros, for use in garbage collector. * src/alloc.c (compact_font_cache_entry, compact_font_caches): Don't ifdef away font cache compaction on NT_GUI, as the problems which led to that seem to have been solved. (compact_font_cache_entry): Use GC_FONT_SPEC_P, GC_XFONT_SPEC, GC_XFONT_ENTITY, and GC_XFONT_OBJECT, instead of their non-GC_ cousins. (Bug#21999)
Diffstat (limited to 'src/font.h')
-rw-r--r--src/font.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/font.h b/src/font.h
index 1d13e1cb6b0..24c058dd88b 100644
--- a/src/font.h
+++ b/src/font.h
@@ -427,6 +427,13 @@ FONT_SPEC_P (Lisp_Object x)
427 return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX; 427 return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX;
428} 428}
429 429
430/* Like FONT_SPEC_P, but can be used in the garbage collector. */
431INLINE bool
432GC_FONT_SPEC_P (Lisp_Object x)
433{
434 return FONTP (x) && (gc_asize (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX;
435}
436
430/* True iff X is font-entity. */ 437/* True iff X is font-entity. */
431INLINE bool 438INLINE bool
432FONT_ENTITY_P (Lisp_Object x) 439FONT_ENTITY_P (Lisp_Object x)
@@ -434,6 +441,13 @@ FONT_ENTITY_P (Lisp_Object x)
434 return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX; 441 return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX;
435} 442}
436 443
444/* Like FONT_ENTITY_P, but can be used in the garbage collector. */
445INLINE bool
446GC_FONT_ENTITY_P (Lisp_Object x)
447{
448 return FONTP (x) && (gc_asize (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX;
449}
450
437/* True iff X is font-object. */ 451/* True iff X is font-object. */
438INLINE bool 452INLINE bool
439FONT_OBJECT_P (Lisp_Object x) 453FONT_OBJECT_P (Lisp_Object x)
@@ -441,6 +455,13 @@ FONT_OBJECT_P (Lisp_Object x)
441 return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX; 455 return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX;
442} 456}
443 457
458/* Like FONT_OBJECT_P, but can be used in the garbage collector. */
459INLINE bool
460GC_FONT_OBJECT_P (Lisp_Object x)
461{
462 return FONTP (x) && (gc_asize (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX;
463}
464
444/* Type checking functions for various font-related objects. */ 465/* Type checking functions for various font-related objects. */
445 466
446INLINE void 467INLINE void
@@ -476,6 +497,13 @@ XFONT_SPEC (Lisp_Object p)
476 return XUNTAG (p, Lisp_Vectorlike); 497 return XUNTAG (p, Lisp_Vectorlike);
477} 498}
478 499
500INLINE struct font_spec *
501GC_XFONT_SPEC (Lisp_Object p)
502{
503 eassert (GC_FONT_SPEC_P (p));
504 return XUNTAG (p, Lisp_Vectorlike);
505}
506
479INLINE struct font_entity * 507INLINE struct font_entity *
480XFONT_ENTITY (Lisp_Object p) 508XFONT_ENTITY (Lisp_Object p)
481{ 509{
@@ -483,6 +511,13 @@ XFONT_ENTITY (Lisp_Object p)
483 return XUNTAG (p, Lisp_Vectorlike); 511 return XUNTAG (p, Lisp_Vectorlike);
484} 512}
485 513
514INLINE struct font_entity *
515GC_XFONT_ENTITY (Lisp_Object p)
516{
517 eassert (GC_FONT_ENTITY_P (p));
518 return XUNTAG (p, Lisp_Vectorlike);
519}
520
486INLINE struct font * 521INLINE struct font *
487XFONT_OBJECT (Lisp_Object p) 522XFONT_OBJECT (Lisp_Object p)
488{ 523{
@@ -490,6 +525,13 @@ XFONT_OBJECT (Lisp_Object p)
490 return XUNTAG (p, Lisp_Vectorlike); 525 return XUNTAG (p, Lisp_Vectorlike);
491} 526}
492 527
528INLINE struct font *
529GC_XFONT_OBJECT (Lisp_Object p)
530{
531 eassert (GC_FONT_OBJECT_P (p));
532 return XUNTAG (p, Lisp_Vectorlike);
533}
534
493#define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT)) 535#define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT))
494 536
495INLINE struct font * 537INLINE struct font *