summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-09-21 14:18:08 +0100
committerSam James <sam@gentoo.org>2022-10-02 04:31:25 +0100
commita529111f77ff46f4836fe7312e70953bc16587cf (patch)
tree9dc3924cb1a6ef3ef853b7bb45f735365e0b4e6d /base/gsicc_profilecache.c
parentImport Ghostscript 9.56.1 (diff)
downloadghostscript-gpl-patches-ghostscript-10.tar.gz
ghostscript-gpl-patches-ghostscript-10.tar.bz2
ghostscript-gpl-patches-ghostscript-10.zip
Import Ghostscript 10.0ghostscript-10.0ghostscript-10
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'base/gsicc_profilecache.c')
-rw-r--r--base/gsicc_profilecache.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/base/gsicc_profilecache.c b/base/gsicc_profilecache.c
index 3accf4c8..5f545059 100644
--- a/base/gsicc_profilecache.c
+++ b/base/gsicc_profilecache.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2021 Artifex Software, Inc.
+/* Copyright (C) 2001-2022 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -28,6 +28,7 @@
#include "gscms.h"
#include "gsicc_profilecache.h"
#include "gserrors.h"
+#include "assert_.h"
#define ICC_CACHE_MAXPROFILE 50
@@ -54,11 +55,12 @@ gsicc_profilecache_new(gs_memory_t *memory)
/* We want this to be maintained in stable_memory. It should not be effected by the
save and restores */
- result = gs_alloc_struct(memory->stable_memory, gsicc_profile_cache_t,
+ memory = memory->stable_memory;
+ result = gs_alloc_struct(memory, gsicc_profile_cache_t,
&st_profile_cache, "gsicc_profilecache_new");
if ( result == NULL )
return(NULL);
- rc_init_free(result, memory->stable_memory, 1, rc_gsicc_profile_cache_free);
+ rc_init_free(result, memory, 1, rc_gsicc_profile_cache_free);
result->head = NULL;
result->num_entries = 0;
result->memory = memory;
@@ -71,10 +73,11 @@ rc_gsicc_profile_cache_free(gs_memory_t * mem, void *ptr_in, client_name_t cname
gsicc_profile_cache_t *profile_cache = (gsicc_profile_cache_t * ) ptr_in;
gsicc_profile_entry_t *curr = profile_cache->head, *next;
+ assert(mem->stable_memory == profile_cache->memory);
while (curr != NULL ){
next = curr->next;
rc_decrement(curr->color_space, "rc_gsicc_profile_cache_free");
- gs_free_object(profile_cache->memory->stable_memory, curr,
+ gs_free_object(profile_cache->memory, curr,
"rc_gsicc_profile_cache_free");
profile_cache->num_entries--;
curr = next;
@@ -84,7 +87,7 @@ rc_gsicc_profile_cache_free(gs_memory_t * mem, void *ptr_in, client_name_t cname
emprintf1(mem,"gsicc_profile_cache_free, num_entries is %d (should be 0).\n",
profile_cache->num_entries);
#endif
- gs_free_object(profile_cache->memory->stable_memory, profile_cache,
+ gs_free_object(profile_cache->memory, profile_cache,
"rc_gsicc_profile_cache_free");
}
@@ -100,8 +103,8 @@ gsicc_add_cs(gs_gstate * pgs, gs_color_space * colorspace, uint64_t dictkey)
/* The entry has to be added in stable memory. We want them
to be maintained across the gsave and grestore process */
- result = gs_alloc_struct(memory->stable_memory, gsicc_profile_entry_t,
- &st_profile_entry, "gsicc_add_cs");
+ result = gs_alloc_struct(memory, gsicc_profile_entry_t,
+ &st_profile_entry, "gsicc_add_cs");
if (result == NULL)
return; /* FIXME */
@@ -178,7 +181,7 @@ gsicc_remove_cs_entry(gsicc_profile_cache_t *profile_cache)
#ifdef DEBUG
if (profile_cache->num_entries != 0) {
emprintf1(memory, "profile cache list empty, but list has num_entries=%d.\n",
- profile_cache->num_entries);
+ profile_cache->num_entries);
}
#endif
} else {
@@ -191,5 +194,5 @@ gsicc_remove_cs_entry(gsicc_profile_cache_t *profile_cache)
"[icc] Remove cs from cache = "PRI_INTPTR", hash = %"PRIu64"\n",
(intptr_t)curr->color_space, (uint64_t)curr->key);
rc_decrement(curr->color_space, "gsicc_remove_cs_entry");
- gs_free_object(memory->stable_memory, curr, "gsicc_remove_cs_entry");
+ gs_free_object(memory, curr, "gsicc_remove_cs_entry");
}