From: Lars Ingebrigtsen Date: Tue, 8 Dec 2020 23:42:06 +0000 (+0100) Subject: Restore Emacs 27 image cache semantics X-Git-Tag: emacs-28.0.90~4842 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ac341cd629cfcf7e6e15321f8b53100cc6c0507f;p=emacs.git 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). --- 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;