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_object.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_object.c')
-rw-r--r-- | pdf/pdf_object.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pdf/pdf_object.c b/pdf/pdf_object.c index 2f96f213..531eb8eb 100644 --- a/pdf/pdf_object.c +++ b/pdf/pdf_object.c @@ -558,9 +558,10 @@ pdf_array_insert(pdf_obj *obj, pdf_obj *item) int pdf_array_contains(pdf_obj *arr, pdf_obj *obj) { - int i; + int i, len; - for (i = 0; i < pdf_array_len(arr); i++) + len = pdf_array_len(arr); + for (i = 0; i < len; i++) if (!pdf_objcmp(pdf_array_get(arr, i), obj)) return 1; |