aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <[email protected]>2013-08-19 17:14:42 +0200
committerLars Magne Ingebrigtsen <[email protected]>2013-08-19 17:14:42 +0200
commit2a42bbcee8224aedd09afb48dbbe740e7124ae80 (patch)
treee851b1d571d4daa48aa4a5e5cd7384b6706f9b11
parent6da26928029c4598e75a344d57c08ca85dd95f2a (diff)
Fix previous commit.
(imagemagick_get_animation_cache): Revert to previous definition so that it actually works. But keep the memory leak fix.
-rw-r--r--src/image.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/image.c b/src/image.c
index ec89ee076d..00f2a035c4 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7895,6 +7895,7 @@ imagemagick_create_cache (char *signature)
cache->wand = 0;
cache->index = 0;
cache->next = 0;
+ cache->update_time = current_emacs_time ();
return cache;
}
@@ -7927,28 +7928,25 @@ imagemagick_get_animation_cache (MagickWand *wand)
{
char *signature = MagickGetImageSignature (wand);
struct animation_cache *cache;
- struct animation_cache **pcache;
imagemagick_prune_animation_cache ();
+ cache = animation_cache;
- if (! animation_cache)
- animation_cache = cache = imagemagick_create_cache (signature);
- else
+ if (! cache)
{
- for (pcache = &animation_cache; *pcache; pcache = &cache->next)
- {
- cache = *pcache;
- if (! cache)
- {
- animation_cache = cache = imagemagick_create_cache (signature);
- break;
- }
- if (strcmp (signature, cache->signature) == 0)
- {
- DestroyString (signature);
- break;
- }
- }
+ animation_cache = imagemagick_create_cache (signature);
+ return animation_cache;
+ }
+
+ while (strcmp(signature, cache->signature) &&
+ cache->next)
+ cache = cache->next;
+
+ if (strcmp(signature, cache->signature))
+ {
+ cache->next = imagemagick_create_cache (signature);
+ DestroyString (signature);
+ return cache->next;
}
cache->update_time = current_emacs_time ();