| OLD | NEW |
| 1 /////////////////////////////////////////////////////////////////////////////// | 1 /////////////////////////////////////////////////////////////////////////////// |
| 2 // | 2 // |
| 3 /// \file index.c | 3 /// \file index.c |
| 4 /// \brief Handling of .xz Indexes and some other Stream information | 4 /// \brief Handling of .xz Indexes and some other Stream information |
| 5 // | 5 // |
| 6 // Author: Lasse Collin | 6 // Author: Lasse Collin |
| 7 // | 7 // |
| 8 // This file has been put into the public domain. | 8 // This file has been put into the public domain. |
| 9 // You can do whatever you want with this file. | 9 // You can do whatever you want with this file. |
| 10 // | 10 // |
| 11 /////////////////////////////////////////////////////////////////////////////// | 11 /////////////////////////////////////////////////////////////////////////////// |
| 12 | 12 |
| 13 #include "index.h" | 13 #include "index.h" |
| 14 #include "stream_flags_common.h" | 14 #include "stream_flags_common.h" |
| 15 | 15 |
| 16 | 16 |
| 17 /// \brief How many Records to allocate at once | 17 /// \brief How many Records to allocate at once |
| 18 /// | 18 /// |
| 19 /// This should be big enough to avoid making lots of tiny allocations | 19 /// This should be big enough to avoid making lots of tiny allocations |
| 20 /// but small enough to avoid too much unused memory at once. | 20 /// but small enough to avoid too much unused memory at once. |
| 21 #define INDEX_GROUP_SIZE 500 | 21 #define INDEX_GROUP_SIZE 512 |
| 22 | 22 |
| 23 | 23 |
| 24 /// \brief How many Records can be allocated at once at maximum | 24 /// \brief How many Records can be allocated at once at maximum |
| 25 #define PREALLOC_MAX ((SIZE_MAX - sizeof(index_group)) / sizeof(index_record)) | 25 #define PREALLOC_MAX ((SIZE_MAX - sizeof(index_group)) / sizeof(index_record)) |
| 26 | 26 |
| 27 | 27 |
| 28 /// \brief Base structure for index_stream and index_group structures | 28 /// \brief Base structure for index_stream and index_group structures |
| 29 typedef struct index_tree_node_s index_tree_node; | 29 typedef struct index_tree_node_s index_tree_node; |
| 30 struct index_tree_node_s { | 30 struct index_tree_node_s { |
| 31 /// Uncompressed start offset of this Stream (relative to the | 31 /// Uncompressed start offset of this Stream (relative to the |
| (...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 } | 1232 } |
| 1233 | 1233 |
| 1234 iter->internal[ITER_STREAM].p = stream; | 1234 iter->internal[ITER_STREAM].p = stream; |
| 1235 iter->internal[ITER_GROUP].p = group; | 1235 iter->internal[ITER_GROUP].p = group; |
| 1236 iter->internal[ITER_RECORD].s = left; | 1236 iter->internal[ITER_RECORD].s = left; |
| 1237 | 1237 |
| 1238 iter_set_info(iter); | 1238 iter_set_info(iter); |
| 1239 | 1239 |
| 1240 return false; | 1240 return false; |
| 1241 } | 1241 } |
| OLD | NEW |