-/* API function documented in wimlib.h */
-WIMLIBAPI void
-wimlib_lzx_free_context(struct wimlib_lzx_context *_ctx)
-{
- struct lzx_compressor *ctx = (struct lzx_compressor*)_ctx;
-
- if (ctx) {
- FREE(ctx->chosen_matches);
- FREE(ctx->cached_matches);
- FREE(ctx->optimum);
- FREE(ctx->salink);
- FREE(ctx->SA);
- FREE(ctx->block_specs);
- FREE(ctx->prev_tab);
- FREE(ctx->window);
- FREE(ctx);
- }
-}
-
-/* API function documented in wimlib.h */
-WIMLIBAPI unsigned
-wimlib_lzx_compress(const void * const restrict uncompressed_data,
- unsigned const uncompressed_len,
- void * const restrict compressed_data)
-{
- int ret;
- struct wimlib_lzx_context *ctx = NULL;
- unsigned compressed_len;
-
- ret = wimlib_lzx_alloc_context(32768, NULL, &ctx);
- if (ret) {
- wimlib_assert(ret != WIMLIB_ERR_INVALID_PARAM);
- WARNING("Couldn't allocate LZX compression context: %"TS"",
- wimlib_get_error_string(ret));
- return 0;
- }
-
- compressed_len = wimlib_lzx_compress2(uncompressed_data,
- uncompressed_len,
- compressed_data,
- ctx);
-
- wimlib_lzx_free_context(ctx);
-
- return compressed_len;
-}
+const struct compressor_ops lzx_compressor_ops = {
+ .create_compressor = lzx_create_compressor,
+ .compress = lzx_compress,
+ .free_compressor = lzx_free_compressor,
+};