From 4474016586b15a3a4d4e76bb36cbfc24b34a6450 Mon Sep 17 00:00:00 2001 From: Pip Cet Date: Tue, 17 Mar 2026 20:53:51 +0000 Subject: [PATCH] Make image and face caches exact (unprotected) roots * src/image.c (make_image_cache): Use 'igc_xalloc_raw_exact'. (cache_image): Use 'igc_xpalloc_raw_exact'. * src/xfaces.c (make_face_cache): Use 'igc_xalloc_raw_exact'. (uncache_face): Use 'igc_xpalloc_raw_exact'. --- src/image.c | 7 ++++--- src/xfaces.c | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/image.c b/src/image.c index d477d04034d..b5a0302422f 100644 --- a/src/image.c +++ b/src/image.c @@ -2219,8 +2219,8 @@ make_image_cache (void) c->images = xmalloc (c->size * sizeof *c->images); c->buckets = xzalloc (IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets); #else - c->images = igc_xzalloc_ambig (c->size * sizeof *c->images); - c->buckets = igc_xzalloc_ambig (IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets); + c->images = igc_xalloc_raw_exact (c->size); + c->buckets = igc_xalloc_raw_exact (IMAGE_CACHE_BUCKETS_SIZE); #endif /* This value should never be encountered. */ c->scaling_col_width = -1; @@ -3703,7 +3703,8 @@ cache_image (struct frame *f, struct image *img) #ifndef HAVE_MPS c->images = xpalloc (c->images, &c->size, 1, -1, sizeof *c->images); #else - c->images = igc_xpalloc_ambig (c->images, &c->size, 1, -1, sizeof *c->images); + c->images = igc_xpalloc_raw_exact (c->images, &c->size, 1, -1, + "image cache"); #endif } diff --git a/src/xfaces.c b/src/xfaces.c index 84f405d7930..8eefb3ac753 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4867,8 +4867,8 @@ make_face_cache (struct frame *f) c->size = 50; c->used = 0; #ifdef HAVE_MPS - c->buckets = igc_xzalloc_ambig (FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets); - c->faces_by_id = igc_xzalloc_ambig (c->size * sizeof *c->faces_by_id); + c->buckets = igc_xalloc_raw_exact (FACE_CACHE_BUCKETS_SIZE); + c->faces_by_id = igc_xalloc_raw_exact (c->size); #else c->buckets = xzalloc (FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets); c->faces_by_id = xzalloc (c->size * sizeof *c->faces_by_id); @@ -5069,8 +5069,8 @@ cache_face (struct face_cache *c, struct face *face, uintptr_t hash) { #ifdef HAVE_MPS c->faces_by_id - = igc_xpalloc_ambig (c->faces_by_id, &c->size, 1, MAX_FACE_ID, - sizeof *c->faces_by_id); + = igc_xpalloc_raw_exact (c->faces_by_id, &c->size, 1, + MAX_FACE_ID, "face cache"); #else c->faces_by_id = xpalloc (c->faces_by_id, &c->size, 1, MAX_FACE_ID,