summaryrefslogtreecommitdiff
path: root/src/cos_object.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2018-01-16 23:35:36 +0000
committerVincent Sanders <vince@kyllikki.org>2018-01-16 23:35:36 +0000
commit096ab0ff30ae4a0f257ef26ae9df119defb3e3a7 (patch)
tree37a76698244ec3b56ee7ab5a035bdf48f91dd1c7 /src/cos_object.h
parenta59a9fcbb5dd67f4368e88b9caa773b9c56811f9 (diff)
downloadlibnspdf-096ab0ff30ae4a0f257ef26ae9df119defb3e3a7.tar.gz
libnspdf-096ab0ff30ae4a0f257ef26ae9df119defb3e3a7.tar.bz2
fix list parse and construction
change lists to be represented by pointer arrays grown in 32 entry blocks instead of linked list. This also ensures lists are constructed in the correct order and makes enumeration and indexing much more efficient.
Diffstat (limited to 'src/cos_object.h')
-rw-r--r--src/cos_object.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/cos_object.h b/src/cos_object.h
index b90ef15..2e763e2 100644
--- a/src/cos_object.h
+++ b/src/cos_object.h
@@ -45,12 +45,18 @@ struct cos_dictionary_entry {
struct cos_object *value;
};
-struct cos_array_entry {
- /** next value in array */
- struct cos_array_entry *next;
+/**
+ * array of COS objects
+ */
+struct cos_array {
+ /** number of values */
+ unsigned int length;
- /** value */
- struct cos_object *value;
+ /** number of allocated values */
+ unsigned int alloc;
+
+ /** array of object pointers */
+ struct cos_object **values;
};
struct cos_string {
@@ -96,7 +102,7 @@ struct cos_object {
struct cos_dictionary_entry *dictionary;
/* array */
- struct cos_array_entry *array;
+ struct cos_array *array;
/** reference */
struct cos_reference *reference;