From 85acde2ab5c2327c8f70ea3c284f26de4a44128b Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 9 Dec 2020 01:10:04 +0100 Subject: [PATCH] Make uncache_image slightly more efficient * src/image.c (uncache_image): Extremely minor speed-up: Only compute the hash once. --- src/image.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/image.c b/src/image.c index 846f2d1a5b3..522a4cf7c0f 100644 --- a/src/image.c +++ b/src/image.c @@ -1633,12 +1633,13 @@ static void uncache_image (struct frame *f, Lisp_Object spec) { struct image *img; + EMACS_UINT hash = sxhash (spec); /* Because the background colors are based on the current face, we can have multiple copies of an image with the same spec. We want to remove them all to ensure the user doesn't see an old version of the image when the face changes. */ - while ((img = search_image_cache (f, spec, sxhash (spec), 0, 0, true))) + while ((img = search_image_cache (f, spec, hash, 0, 0, true))) { free_image (f, img); /* As display glyphs may still be referring to the image ID, we -- 2.39.2