From 2be507bfb199e8c80e4b2ee1cb2c867b57fc1f6e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 8 Jul 2016 14:24:54 +0200 Subject: Use fz_keep_imp and fz_drop_imp for all reference counting. --- source/fitz/separation.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'source/fitz/separation.c') diff --git a/source/fitz/separation.c b/source/fitz/separation.c index e18691cf..9968b574 100644 --- a/source/fitz/separation.c +++ b/source/fitz/separation.c @@ -22,34 +22,20 @@ fz_separations *fz_new_separations(fz_context *ctx) fz_separations *fz_keep_separations(fz_context *ctx, fz_separations *sep) { - int i; - if (!ctx || !sep) return NULL; - fz_lock(ctx, FZ_LOCK_ALLOC); - i = sep->refs; - if (i > 0) - sep->refs++; - fz_unlock(ctx, FZ_LOCK_ALLOC); - - return sep; + return fz_keep_imp(ctx, sep, &sep->refs); } void fz_drop_separations(fz_context *ctx, fz_separations *sep) { - int i; - if (!ctx || !sep) return; - fz_lock(ctx, FZ_LOCK_ALLOC); - i = sep->refs; - if (i > 0) - sep->refs--; - fz_unlock(ctx, FZ_LOCK_ALLOC); - if (i == 1) + if (fz_drop_imp(ctx, sep, &sep->refs)) { + int i; for (i = 0; i < sep->num_separations; i++) fz_free(ctx, sep->name[i]); fz_free(ctx, sep); -- cgit v1.2.3