aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/common/next_coder.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-08-28 22:53:15 +0300
committerLasse Collin <lasse.collin@tukaani.org>2008-08-28 22:53:15 +0300
commit3b34851de1eaf358cf9268922fa0eeed8278d680 (patch)
tree7bab212af647541df64227a8d350d17a2e789f6b /src/liblzma/common/next_coder.c
parentFix test_filter_flags to match the new restriction of lc+lp. (diff)
downloadxz-3b34851de1eaf358cf9268922fa0eeed8278d680.tar.xz
Sort of garbage collection commit. :-| Many things are still
broken. API has changed a lot and it will still change a little more here and there. The command line tool doesn't have all the required changes to reflect the API changes, so it's easy to get "internal error" or trigger assertions.
Diffstat (limited to 'src/liblzma/common/next_coder.c')
-rw-r--r--src/liblzma/common/next_coder.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/liblzma/common/next_coder.c b/src/liblzma/common/next_coder.c
deleted file mode 100644
index c10fe24d..00000000
--- a/src/liblzma/common/next_coder.c
+++ /dev/null
@@ -1,65 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-/// \file next_coder.c
-/// \brief Initializing and freeing the next coder in the chain
-//
-// Copyright (C) 2007 Lasse Collin
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#include "common.h"
-
-extern lzma_ret
-lzma_next_filter_init(lzma_next_coder *next, lzma_allocator *allocator,
- const lzma_filter_info *filters)
-{
- lzma_ret ret = LZMA_OK;
-
- // Free the existing coder if it is different than the current one.
- if ((uintptr_t)(filters[0].init) != next->init)
- lzma_next_coder_end(next, allocator);
-
- if (filters[0].init != NULL) {
- // Initialize the new coder.
- ret = filters[0].init(next, allocator, filters);
-
- // Set the init function pointer if initialization was
- // successful. next->code and next->end are set by the
- // initialization function itself.
- if (ret == LZMA_OK) {
- next->init = (uintptr_t)(filters[0].init);
- assert(next->code != NULL);
- assert(next->end != NULL);
- } else {
- lzma_next_coder_end(next, allocator);
- }
- }
-
- return ret;
-}
-
-
-extern void
-lzma_next_coder_end(lzma_next_coder *next, lzma_allocator *allocator)
-{
- if (next != NULL) {
- if (next->end != NULL)
- next->end(next->coder, allocator);
-
- // Reset the variables so the we don't accidentally think
- // that it is an already initialized coder.
- *next = LZMA_NEXT_CODER_INIT;
- }
-
- return;
-}