aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/index.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-12-15 19:39:13 +0200
committerLasse Collin <lasse.collin@tukaani.org>2008-12-15 19:39:13 +0200
commit671a5adf1e844bfdd6fd327016c3c28694493158 (patch)
tree87f8e40cb30f2641b5b211e3bd3bec9ce084c95e /src/liblzma/common/index.c
parentThe LZMA2 decoder fix introduced a bug to LZ decoder, (diff)
downloadxz-671a5adf1e844bfdd6fd327016c3c28694493158.tar.xz
Bunch of liblzma API cleanups and fixes.
Diffstat (limited to 'src/liblzma/common/index.c')
-rw-r--r--src/liblzma/common/index.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/liblzma/common/index.c b/src/liblzma/common/index.c
index 1fe65650..d7025fff 100644
--- a/src/liblzma/common/index.c
+++ b/src/liblzma/common/index.c
@@ -114,6 +114,17 @@ struct lzma_index_s {
};
+extern LZMA_API lzma_vli
+lzma_index_memusage(lzma_vli count)
+{
+ if (count > LZMA_VLI_MAX)
+ return UINT64_MAX;
+
+ return sizeof(lzma_index) + (count + INDEX_GROUP_SIZE - 1)
+ / INDEX_GROUP_SIZE * sizeof(lzma_index_group);
+}
+
+
static void
free_index_list(lzma_index *i, lzma_allocator *allocator)
{