summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-04-11 09:50:55 +0100
committerRobin Watts <robin.watts@artifex.com>2012-04-11 09:52:41 +0100
commit42c6f088344544b5e854899e4126e0d3ec4ee496 (patch)
tree7e09aaf1bd108fcd56da2a3df94712c51063b319
parentebc8452e68710ace66b3acca4d1701bfa6f59143 (diff)
Slight hack in gsmchunk.c for Memento builds.
In Memento builds we nobble the chunk manager to only put a single block in each chunk. As such, the debugging is much nicer if we label the chunks with the block name rather than "chunk_mem_node_add".
-rw-r--r--gs/base/gsmchunk.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gs/base/gsmchunk.c b/gs/base/gsmchunk.c
index 41fc17a99..e16da8082 100644
--- a/gs/base/gsmchunk.c
+++ b/gs/base/gsmchunk.c
@@ -289,7 +289,11 @@ round_up_to_align(uint size)
/* return -1 on error, 0 on success */
static int
chunk_mem_node_add(gs_memory_chunk_t *cmem, uint size_needed, bool is_multiple_object_chunk,
- chunk_mem_node_t **newchunk)
+ chunk_mem_node_t **newchunk
+#ifdef MEMENTO
+ , client_name_t cname
+#endif
+ )
{
chunk_mem_node_t *node;
gs_memory_t *target = cmem->target;
@@ -306,7 +310,14 @@ chunk_mem_node_add(gs_memory_chunk_t *cmem, uint size_needed, bool is_multiple_o
is_multiple_object_chunk = false;
*newchunk = NULL;
- node = (chunk_mem_node_t *)gs_alloc_bytes_immovable(target, chunk_size, "chunk_mem_node_add");
+#ifdef MEMENTO
+#define LOCAL_CNAME cname
+#else
+#define LOCAL_CNAME "chunk_mem_node_add"
+#endif
+ node = (chunk_mem_node_t *)gs_alloc_bytes_immovable(target, chunk_size,
+ LOCAL_CNAME);
+#undef LOCAL_CNAME
if (node == NULL)
return -1;
cmem->used += chunk_size;
@@ -418,7 +429,11 @@ chunk_obj_alloc(gs_memory_t *mem, uint size, gs_memory_type_ptr_t type, client_n
}
if (current == NULL) {
/* No chunks with enough space or size makes this a single object, allocate one */
- if (chunk_mem_node_add(cmem, newsize, is_multiple_object_size, &current) < 0) {
+ if (chunk_mem_node_add(cmem, newsize, is_multiple_object_size, &current
+#ifdef MEMENTO
+ , cname
+#endif
+ ) < 0) {
#ifdef DEBUG
if (gs_debug_c('a'))
dlprintf1("[a+]chunk_obj_alloc(chunk_mem_node_add)(%u) Failed.\n", size);