summaryrefslogtreecommitdiff
path: root/apps/mupdfclean.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-07-04 16:50:36 +0100
committerRobin Watts <robin.watts@artifex.com>2012-07-05 11:01:51 +0100
commitf23e5052e23a42057ef2c4025a38b9fc29ccd00c (patch)
tree8b43a48b380fb5a37eeb1910d1b91834bb6313f7 /apps/mupdfclean.c
parent808e051272c2a0b1e32e252fd14cdaf65c452132 (diff)
downloadmupdf-f23e5052e23a42057ef2c4025a38b9fc29ccd00c.tar.xz
Avoid calling pdf_array_len (and friends) in a loop.
for(i = 0; i < pdf_array_len(x); i++) ... results in lots of calls to pdf_array_len. This is not what we want.
Diffstat (limited to 'apps/mupdfclean.c')
-rw-r--r--apps/mupdfclean.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/mupdfclean.c b/apps/mupdfclean.c
index 8eb30efe..264d8edc 100644
--- a/apps/mupdfclean.c
+++ b/apps/mupdfclean.c
@@ -123,8 +123,9 @@ static void retainpages(int argc, char **argv)
pdf_obj *names = pdf_new_dict(ctx, 1);
pdf_obj *dests = pdf_new_dict(ctx, 1);
pdf_obj *names_list = pdf_new_array(ctx, 32);
+ int len = pdf_dict_len(olddests);
- for (i = 0; i < pdf_dict_len(olddests); i++)
+ for (i = 0; i < len; i++)
{
pdf_obj *key = pdf_dict_get_key(olddests, i);
pdf_obj *val = pdf_dict_get_val(olddests, i);