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 // |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 } | 391 } |
392 | 392 |
393 return i; | 393 return i; |
394 } | 394 } |
395 | 395 |
396 | 396 |
397 extern LZMA_API(lzma_index *) | 397 extern LZMA_API(lzma_index *) |
398 lzma_index_init(lzma_allocator *allocator) | 398 lzma_index_init(lzma_allocator *allocator) |
399 { | 399 { |
400 lzma_index *i = index_init_plain(allocator); | 400 lzma_index *i = index_init_plain(allocator); |
| 401 if (i == NULL) |
| 402 return NULL; |
| 403 |
401 index_stream *s = index_stream_init(0, 0, 1, 0, allocator); | 404 index_stream *s = index_stream_init(0, 0, 1, 0, allocator); |
402 » if (i == NULL || s == NULL) { | 405 » if (s == NULL) { |
403 » » index_stream_end(s, allocator); | |
404 lzma_free(i, allocator); | 406 lzma_free(i, allocator); |
| 407 return NULL; |
405 } | 408 } |
406 | 409 |
407 index_tree_append(&i->streams, &s->node); | 410 index_tree_append(&i->streams, &s->node); |
408 | 411 |
409 return i; | 412 return i; |
410 } | 413 } |
411 | 414 |
412 | 415 |
413 extern LZMA_API(void) | 416 extern LZMA_API(void) |
414 lzma_index_end(lzma_index *i, lzma_allocator *allocator) | 417 lzma_index_end(lzma_index *i, lzma_allocator *allocator) |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 } | 1235 } |
1233 | 1236 |
1234 iter->internal[ITER_STREAM].p = stream; | 1237 iter->internal[ITER_STREAM].p = stream; |
1235 iter->internal[ITER_GROUP].p = group; | 1238 iter->internal[ITER_GROUP].p = group; |
1236 iter->internal[ITER_RECORD].s = left; | 1239 iter->internal[ITER_RECORD].s = left; |
1237 | 1240 |
1238 iter_set_info(iter); | 1241 iter_set_info(iter); |
1239 | 1242 |
1240 return false; | 1243 return false; |
1241 } | 1244 } |
OLD | NEW |