diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-07-04 16:50:36 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-07-05 11:01:51 +0100 |
commit | f23e5052e23a42057ef2c4025a38b9fc29ccd00c (patch) | |
tree | 8b43a48b380fb5a37eeb1910d1b91834bb6313f7 /pdf/pdf_nametree.c | |
parent | 808e051272c2a0b1e32e252fd14cdaf65c452132 (diff) | |
download | mupdf-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 'pdf/pdf_nametree.c')
-rw-r--r-- | pdf/pdf_nametree.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pdf/pdf_nametree.c b/pdf/pdf_nametree.c index 73755e22..7d8ac319 100644 --- a/pdf/pdf_nametree.c +++ b/pdf/pdf_nametree.c @@ -120,14 +120,16 @@ pdf_load_name_tree_imp(pdf_obj *dict, pdf_document *xref, pdf_obj *node) if (kids && !pdf_dict_mark(node)) { - for (i = 0; i < pdf_array_len(kids); i++) + int len = pdf_array_len(kids); + for (i = 0; i < len; i++) pdf_load_name_tree_imp(dict, xref, pdf_array_get(kids, i)); pdf_dict_unmark(node); } if (names) { - for (i = 0; i + 1 < pdf_array_len(names); i += 2) + int len = pdf_array_len(names); + for (i = 0; i + 1 < len; i += 2) { pdf_obj *key = pdf_array_get(names, i); pdf_obj *val = pdf_array_get(names, i + 1); |