diff options
author | Paul Gardiner <paulg.artifex@glidos.net> | 2013-06-27 15:31:29 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-06-28 19:26:42 +0100 |
commit | 063c7175976213010ce1c3c96c4d4b9703239eb0 (patch) | |
tree | 1f73d687af976b77b429a66c9ce050377e50cd4a /source/pdf/pdf-xref.c | |
parent | c256490e6927539522e2433e3b300515f85a25bf (diff) | |
download | mupdf-063c7175976213010ce1c3c96c4d4b9703239eb0.tar.xz |
Optimise xref-section extension and improve linked list creation
Diffstat (limited to 'source/pdf/pdf-xref.c')
-rw-r--r-- | source/pdf/pdf-xref.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index cc4a076b..91083468 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -107,16 +107,18 @@ pdf_xref_entry *pdf_get_populating_xref_entry(pdf_document *doc, int num) } /* Ensure all xref sections map this entry */ - for (i = 0; i < doc->num_xref_sections; i++) + for (i = doc->num_xref_sections - 1; i >= 0; i--) { xref = &doc->xref_sections[i]; if (num >= xref->len) pdf_resize_xref(doc->ctx, xref, num+1); + else + break; /* Remaining sections already of sufficient size */ } /* Loop leaves xref pointing at the populating section */ - return &xref->table[num]; + return &doc->xref_sections[doc->num_xref_sections-1].table[num]; } /* Used after loading a document to access entries */ |