summaryrefslogtreecommitdiff
path: root/gs/base/gxclmem.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-09-13 00:40:03 +0100
committerRobin Watts <robin@peeves.(none)>2012-09-18 05:28:21 -0700
commit6777c88fab2afc3e6558fda1dfb51110088ede61 (patch)
treeab0ee337b8e03be4a595703c7177e76ac206e037 /gs/base/gxclmem.c
parent1fa1eca3be2955e1ed1f8433c18d06417ea85f4c (diff)
downloadghostpdl-6777c88fab2afc3e6558fda1dfb51110088ede61.tar.gz
Introduce GS_THREADSAFE define and modify printing calls.
Lots of debugging/error information is printed using eprintf and dlprintf etc. These functions do not take a gs_memory_t * and are not safe for use within code that runs under multiple instances created by gsapi. Introduce new versions (dmprintf, dmlprintf etc) that DO take a gs_memory_ *, and move as much of ghostscript/ghostpdl's usage over to these as possible. I have not touched the contrib directory, and some locations in the code do not easily have a gs_memory_t to hand, so I have left them be. If the GS_THREADSAFE define is made during building, then the functions that don't take an explicit memory handle are #defined away to nothing. If the GS_THREADSAFE define is made, we disable the gsapi check that checks for a single init.
Diffstat (limited to 'gs/base/gxclmem.c')
-rw-r--r--gs/base/gxclmem.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/gs/base/gxclmem.c b/gs/base/gxclmem.c
index 7bdb18375..e41616a66 100644
--- a/gs/base/gxclmem.c
+++ b/gs/base/gxclmem.c
@@ -708,7 +708,7 @@ memfile_next_blk(MEMFILE * f)
/* check if need to start compressing */
if (NEED_TO_COMPRESS(f)) {
- if_debug0(':', "[:]Beginning compression\n");
+ if_debug0m(':', f->memory, "[:]Beginning compression\n");
/* compress the entire file up to this point */
if (!f->compressor_initialized) {
int code = 0;
@@ -890,8 +890,8 @@ memfile_get_pdata(MEMFILE * f)
}
f->raw_tail->fwd = NULL;
num_raw_buffers = i + 1; /* if MALLOC failed, then OK */
- if_debug1(':', "[:]Number of raw buffers allocated=%d\n",
- num_raw_buffers);
+ if_debug1m(':', f->memory, "[:]Number of raw buffers allocated=%d\n",
+ num_raw_buffers);
if (f->decompress_state->templat->init != 0)
code = (*f->decompress_state->templat->init)
(f->decompress_state);
@@ -1125,18 +1125,18 @@ memfile_free_mem(MEMFILE * f)
/* output some diagnostics about the effectiveness */
if (tot_raw > 100) {
if (tot_raw > 0xFFFFFFFF)
- if_debug4(':', "[:]tot_raw=%lu%0lu, tot_compressed=%lu%0lu\n",
- tot_raw >> 32, tot_raw & 0xFFFFFFFF,
- tot_compressed >> 32, tot_compressed & 0xFFFFFFFF);
+ if_debug4m(':', f->memory, "[:]tot_raw=%lu%0lu, tot_compressed=%lu%0lu\n",
+ tot_raw >> 32, tot_raw & 0xFFFFFFFF,
+ tot_compressed >> 32, tot_compressed & 0xFFFFFFFF);
else
- if_debug2(':', "[:]tot_raw=%lu, tot_compressed=%lu\n",
- tot_raw, tot_compressed);
+ if_debug2m(':', f->memory, "[:]tot_raw=%lu, tot_compressed=%lu\n",
+ tot_raw, tot_compressed);
}
if (tot_cache_hits != 0) {
- if_debug3(':', "[:]Cache hits=%lu, cache misses=%lu, swapouts=%lu\n",
- tot_cache_hits,
- (long)(tot_cache_miss - (f->log_length / MEMFILE_DATA_SIZE)),
- tot_swap_out);
+ if_debug3m(':', f->memory, "[:]Cache hits=%lu, cache misses=%lu, swapouts=%lu\n",
+ tot_cache_hits,
+ (long)(tot_cache_miss - (f->log_length / MEMFILE_DATA_SIZE)),
+ tot_swap_out);
}
tot_raw = 0;
tot_compressed = 0;