summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-12-15 20:11:48 +0000
committerRobin Watts <robin.watts@artifex.com>2011-12-15 20:11:48 +0000
commitadfcc880ee441c0dc86518db02b216e8d58231fa (patch)
tree9f8b307e8b2ce24e3730a8afbdbc7a704dfc3686
parent63e9df88676f80f418aedba5cf63ffb49d632444 (diff)
downloadmupdf-adfcc880ee441c0dc86518db02b216e8d58231fa.tar.xz
Memento tweak.
Slight memento tweak to simplify code (and correct problem with repeated event numbers when squeezing).
-rw-r--r--fitz/memento.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/fitz/memento.c b/fitz/memento.c
index 73963f2d..493b9d1c 100644
--- a/fitz/memento.c
+++ b/fitz/memento.c
@@ -641,15 +641,7 @@ void *Memento_malloc(size_t s)
Memento_BlkHeader *memblk;
size_t smem = MEMBLK_SIZE(s);
- if (!globals.inited)
- Memento_init();
-
- Memento_event();
-
- if ((globals.squeezing) && (!globals.squeezed))
- squeeze();
-
- if (globals.failing)
+ if (Memento_failThisEvent())
return NULL;
if (s == 0)
@@ -762,24 +754,17 @@ void *Memento_realloc(void *blk, size_t newsize)
Memento_BlkHeader *memblk, *newmemblk;
size_t newsizemem;
- if (!globals.inited)
- Memento_init();
-
if (blk == NULL)
return Memento_malloc(newsize);
if (newsize == 0) {
Memento_free(blk);
return NULL;
}
- if ((globals.squeezing) && (!globals.squeezed))
- squeeze();
- if (globals.failing)
+
+ if (Memento_failThisEvent())
return NULL;
memblk = MEMBLK_FROMBLK(blk);
-
- Memento_event();
-
if (checkBlock(memblk, "realloc"))
return NULL;