summaryrefslogtreecommitdiff
path: root/fitz/base_object.c
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2011-10-04 18:44:19 +0100
committerRobin Watts <Robin.Watts@artifex.com>2011-10-04 18:44:19 +0100
commitd208be26537db558edb70236ae517cea31b7ebab (patch)
tree57da95b97e354a53bd4517a42010e90968f007d9 /fitz/base_object.c
parentba46cad4b09bb957085900a203206c8fa5868cd4 (diff)
downloadmupdf-d208be26537db558edb70236ae517cea31b7ebab.tar.xz
Move to exception handling rather than error passing throughout.
This frees us from passing errors back everywhere, and hence enables us to pass results back as return values. Rather than having to explicitly check for errors everywhere and bubble them, we now allow exception handling to do the work for us; the downside to this is that we no longer emit as much debugging information as we did before (though this could be put back in). For now, the debugging information we have lost has been retained in comments with 'RJW:' at the start. This code needs fuller testing, but is being committed as a work in progress.
Diffstat (limited to 'fitz/base_object.c')
-rw-r--r--fitz/base_object.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/fitz/base_object.c b/fitz/base_object.c
index fae4b1b4..6307e5e0 100644
--- a/fitz/base_object.c
+++ b/fitz/base_object.c
@@ -795,16 +795,16 @@ fz_free_dict(fz_obj *obj)
void
fz_drop_obj(fz_obj *obj)
{
- assert(obj != NULL);
- if (--obj->refs == 0)
- {
- if (obj->kind == FZ_ARRAY)
- fz_free_array(obj);
- else if (obj->kind == FZ_DICT)
- fz_free_dict(obj);
- else
- fz_free(obj->ctx, obj);
- }
+ if (obj == NULL)
+ return;
+ if (--obj->refs)
+ return;
+ if (obj->kind == FZ_ARRAY)
+ fz_free_array(obj);
+ else if (obj->kind == FZ_DICT)
+ fz_free_dict(obj);
+ else
+ fz_free(obj->ctx, obj);
}
/* Pretty printing objects */