1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-26 08:41:47 -07:00

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'.
This commit is contained in:
Pip Cet 2026-03-17 20:53:51 +00:00
parent 25f120e4d6
commit 4474016586
2 changed files with 8 additions and 7 deletions

View file

@ -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
}

View file

@ -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,