From ac341cd629cfcf7e6e15321f8b53100cc6c0507f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 9 Dec 2020 00:42:06 +0100 Subject: [PATCH] Restore Emacs 27 image cache semantics * src/image.c (equal_lists): Remove. (search_image_cache): Use Fequal instead of equal_lists. Benchmarking shows no measurable time difference, and this restores the cache semantics from Emacs 27 (where file names didn't have to be EQ for the cache to be used). --- src/image.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/image.c b/src/image.c index 5eb41322950..846f2d1a5b3 100644 --- a/src/image.c +++ b/src/image.c @@ -1592,17 +1592,6 @@ make_image_cache (void) return c; } -/* Compare two lists (one of which must be proper), comparing each - element with `eq'. */ -static bool -equal_lists (Lisp_Object a, Lisp_Object b) -{ - while (CONSP (a) && CONSP (b) && EQ (XCAR (a), XCAR (b))) - a = XCDR (a), b = XCDR (b); - - return EQ (a, b); -} - /* Find an image matching SPEC in the cache, and return it. If no image is found, return NULL. */ static struct image * @@ -1630,7 +1619,7 @@ search_image_cache (struct frame *f, Lisp_Object spec, EMACS_UINT hash, for (img = c->buckets[i]; img; img = img->next) if (img->hash == hash - && equal_lists (img->spec, spec) + && !NILP (Fequal (img->spec, spec)) && (ignore_colors || (img->face_foreground == foreground && img->face_background == background))) break; -- 2.39.2