+
+static void
+lzx_free_decompressor(void *_ctx)
+{
+ struct lzx_decompressor *ctx = _ctx;
+
+ FREE(ctx);
+}
+
+static int
+lzx_create_decompressor(size_t max_window_size,
+ const struct wimlib_decompressor_params_header *params,
+ void **ctx_ret)
+{
+ struct lzx_decompressor *ctx;
+
+ if (!lzx_window_size_valid(max_window_size))
+ return WIMLIB_ERR_INVALID_PARAM;
+
+ ctx = MALLOC(sizeof(struct lzx_decompressor));
+ if (ctx == NULL)
+ return WIMLIB_ERR_NOMEM;
+
+ ctx->max_window_size = max_window_size;
+ ctx->num_main_syms = lzx_get_num_main_syms(max_window_size);
+
+ *ctx_ret = ctx;
+ return 0;
+}
+
+const struct decompressor_ops lzx_decompressor_ops = {
+ .create_decompressor = lzx_create_decompressor,
+ .decompress = lzx_decompress,
+ .free_decompressor = lzx_free_decompressor,
+};