mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-21 06:11:50 -07:00
Don't use remote references in image cache (bug#80601)
Using ambiguous references is suboptimal here, but there isn't currently a suitable type to use for arrays of raw pointers. * src/image.c (make_image_cache) [MPS]: Use 'igc_xzalloc_ambig'. (free_image_cache) [MPS]: Use 'igc_xfree'. (cache_image) [MPS]: Use 'igc_xpalloc_amig'. * src/igc.c (fix_image_cache): Removed. (dflt_scan_obj): Call to 'fix_image_cache' removed.
This commit is contained in:
parent
2963e3c9fc
commit
55b7a62051
2 changed files with 19 additions and 21 deletions
23
src/igc.c
23
src/igc.c
|
|
@ -2011,26 +2011,6 @@ fix_image (mps_ss_t ss, struct image *i)
|
|||
return MPS_RES_OK;
|
||||
}
|
||||
|
||||
static mps_res_t
|
||||
fix_image_cache (mps_ss_t ss, struct image_cache *c)
|
||||
{
|
||||
MPS_SCAN_BEGIN (ss)
|
||||
{
|
||||
#ifdef HAVE_WINDOW_SYSTEM
|
||||
if (c->images)
|
||||
for (ptrdiff_t i = 0; i < c->used; ++i)
|
||||
IGC_FIX12_RAW (ss, &c->images[i]);
|
||||
|
||||
if (c->buckets)
|
||||
for (ptrdiff_t i = 0; i < IMAGE_CACHE_BUCKETS_SIZE; ++i)
|
||||
if (c->buckets[i])
|
||||
IGC_FIX12_RAW (ss, &c->buckets[i]);
|
||||
#endif
|
||||
}
|
||||
MPS_SCAN_END (ss);
|
||||
return MPS_RES_OK;
|
||||
}
|
||||
|
||||
static mps_res_t
|
||||
fix_face (mps_ss_t ss, struct face *f)
|
||||
{
|
||||
|
|
@ -2556,7 +2536,8 @@ dflt_scan_obj (mps_ss_t ss, mps_addr_t start)
|
|||
break;
|
||||
|
||||
case IGC_OBJ_IMAGE_CACHE:
|
||||
IGC_FIX_CALL_FN (ss, struct image_cache, addr, fix_image_cache);
|
||||
/* FIXME/igc: image caches temporarily changed to use ambiguous
|
||||
references. Going back to exact refs would be best. */
|
||||
break;
|
||||
|
||||
case IGC_OBJ_FACE:
|
||||
|
|
|
|||
17
src/image.c
17
src/image.c
|
|
@ -2215,8 +2215,13 @@ make_image_cache (void)
|
|||
|
||||
c->size = 50;
|
||||
c->used = c->refcount = 0;
|
||||
#ifndef HAVE_MPS
|
||||
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);
|
||||
#endif
|
||||
/* This value should never be encountered. */
|
||||
c->scaling_col_width = -1;
|
||||
return c;
|
||||
|
|
@ -2338,9 +2343,17 @@ free_image_cache (struct frame *f)
|
|||
|
||||
for (i = 0; i < c->used; ++i)
|
||||
free_image (f, c->images[i]);
|
||||
#ifdef HAVE_MPS
|
||||
igc_xfree (c->images);
|
||||
#else
|
||||
xfree (c->images);
|
||||
#endif
|
||||
c->images = NULL;
|
||||
#ifdef HAVE_MPS
|
||||
igc_xfree (c->buckets);
|
||||
#else
|
||||
xfree (c->buckets);
|
||||
#endif
|
||||
c->buckets = NULL;
|
||||
#ifndef HAVE_MPS
|
||||
xfree (c);
|
||||
|
|
@ -3687,7 +3700,11 @@ cache_image (struct frame *f, struct image *img)
|
|||
/* If no free slot found, maybe enlarge c->images. */
|
||||
if (i == c->used && c->used == c->size)
|
||||
{
|
||||
#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);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Add IMG to c->images, and assign IMG an id. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue