aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfaces.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xfaces.c')
-rw-r--r--src/xfaces.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index fecd8e546cf..84d49e30a9b 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5579,12 +5579,19 @@ cache_face (c, face, hash)
5579 face->id = i; 5579 face->id = i;
5580 5580
5581 /* Maybe enlarge C->faces_by_id. */ 5581 /* Maybe enlarge C->faces_by_id. */
5582 if (i == c->used && c->used == c->size) 5582 if (i == c->used)
5583 { 5583 {
5584 int new_size = 2 * c->size; 5584 if (c->used == c->size)
5585 int sz = new_size * sizeof *c->faces_by_id; 5585 {
5586 c->faces_by_id = (struct face **) xrealloc (c->faces_by_id, sz); 5586 int new_size, sz;
5587 c->size = new_size; 5587 new_size = min (2 * c->size, MAX_FACE_ID);
5588 if (new_size == c->size)
5589 abort (); /* Alternatives? ++kfs */
5590 sz = new_size * sizeof *c->faces_by_id;
5591 c->faces_by_id = (struct face **) xrealloc (c->faces_by_id, sz);
5592 c->size = new_size;
5593 }
5594 c->used++;
5588 } 5595 }
5589 5596
5590#if GLYPH_DEBUG 5597#if GLYPH_DEBUG
@@ -5603,8 +5610,6 @@ cache_face (c, face, hash)
5603#endif /* GLYPH_DEBUG */ 5610#endif /* GLYPH_DEBUG */
5604 5611
5605 c->faces_by_id[i] = face; 5612 c->faces_by_id[i] = face;
5606 if (i == c->used)
5607 ++c->used;
5608} 5613}
5609 5614
5610 5615