summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-write.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/pdf/pdf-write.c')
-rw-r--r--source/pdf/pdf-write.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c
index 27ff94d6..5183b285 100644
--- a/source/pdf/pdf-write.c
+++ b/source/pdf/pdf-write.c
@@ -796,8 +796,7 @@ static void renumberobj(fz_context *ctx, pdf_document *doc, pdf_write_state *opt
val = pdf_new_null(ctx, doc);
else
val = pdf_new_indirect(ctx, doc, opts->renumber_map[o], 0);
- pdf_dict_put(ctx, obj, key, val);
- pdf_drop_obj(ctx, val);
+ pdf_dict_put_drop(ctx, obj, key, val);
}
else
{
@@ -819,8 +818,7 @@ static void renumberobj(fz_context *ctx, pdf_document *doc, pdf_write_state *opt
val = pdf_new_null(ctx, doc);
else
val = pdf_new_indirect(ctx, doc, opts->renumber_map[o], 0);
- pdf_array_put(ctx, obj, i, val);
- pdf_drop_obj(ctx, val);
+ pdf_array_put_drop(ctx, obj, i, val);
}
else
{
@@ -1681,8 +1679,7 @@ static void copystream(fz_context *ctx, pdf_document *doc, pdf_write_state *opts
}
newlen = pdf_new_int(ctx, doc, (int)len);
- pdf_dict_put(ctx, obj, PDF_NAME_Length, newlen);
- pdf_drop_obj(ctx, newlen);
+ pdf_dict_put_drop(ctx, obj, PDF_NAME_Length, newlen);
fz_write_printf(ctx, opts->out, "%d %d obj\n", num, gen);
pdf_print_obj(ctx, opts->out, obj, opts->do_tight);
@@ -1744,8 +1741,7 @@ static void expandstream(fz_context *ctx, pdf_document *doc, pdf_write_state *op
}
newlen = pdf_new_int(ctx, doc, (int)len);
- pdf_dict_put(ctx, obj, PDF_NAME_Length, newlen);
- pdf_drop_obj(ctx, newlen);
+ pdf_dict_put_drop(ctx, obj, PDF_NAME_Length, newlen);
fz_write_printf(ctx, opts->out, "%d %d obj\n", num, gen);
pdf_print_obj(ctx, opts->out, obj, opts->do_tight);
@@ -1971,7 +1967,6 @@ static void writexref(fz_context *ctx, pdf_document *doc, pdf_write_state *opts,
fz_write_string(ctx, opts->out, "\n");
fz_var(trailer);
- fz_var(nobj);
fz_try(ctx)
{
@@ -1987,9 +1982,7 @@ static void writexref(fz_context *ctx, pdf_document *doc, pdf_write_state *opts,
trailer = pdf_new_dict(ctx, doc, 5);
nobj = pdf_new_int(ctx, doc, to);
- pdf_dict_put(ctx, trailer, PDF_NAME_Size, nobj);
- pdf_drop_obj(ctx, nobj);
- nobj = NULL;
+ pdf_dict_put_drop(ctx, trailer, PDF_NAME_Size, nobj);
if (first)
{
@@ -2008,16 +2001,10 @@ static void writexref(fz_context *ctx, pdf_document *doc, pdf_write_state *opts,
if (main_xref_offset != 0)
{
nobj = pdf_new_int(ctx, doc, main_xref_offset);
- pdf_dict_put(ctx, trailer, PDF_NAME_Prev, nobj);
- pdf_drop_obj(ctx, nobj);
- nobj = NULL;
+ pdf_dict_put_drop(ctx, trailer, PDF_NAME_Prev, nobj);
}
}
}
- fz_always(ctx)
- {
- pdf_drop_obj(ctx, nobj);
- }
fz_catch(ctx)
{
fz_rethrow(ctx);