Skip to content

Remove dead decompress helpers and fix two copy-paste slips - #154

Open
sribalakumar wants to merge 1 commit into
SpringMT:mainfrom
sribalakumar:cleanup-dead-code-and-typos
Open

Remove dead decompress helpers and fix two copy-paste slips#154
sribalakumar wants to merge 1 commit into
SpringMT:mainfrom
sribalakumar:cleanup-dead-code-and-typos

Conversation

@sribalakumar

Copy link
Copy Markdown

Summary

This is pure cleanup with no behaviour change. It's deliberately kept as a separate PR from the GVL fix so each can be reviewed independently on its own merits.

Changes

  • Remove dead code that nothing calls any more: the one-shot decompress path zstd_decompress, its decompress_wrapper function, and the decompress_params struct — all in common.h — plus decompress_buffered in zstdruby.c. These are leftovers from when Zstd.decompress was rewritten to use decode_one_frame / ZSTD_decompressStream. The streaming wrapper stream_decompress_wrapper is a different function that is still in use and is left untouched.

  • Fix a wrong pointer type in rb_ddict_alloc: a local was declared ZSTD_CDict* (the compress-dictionary type) while it actually holds a decompress dictionary. Corrected to ZSTD_DDict*. The variable is NULL at that point, so this was a cosmetic type-naming issue with no functional effect.

  • Fix a wrong error message in set_decompress_params: the error raised on a DDict-load failure read "ZSTD_CCtx_loadDictionary failed" (the compress-context function) when it should reference the decompress-context function. Corrected to "ZSTD_DCtx_loadDictionary failed".

Verification

The full test suite passes: 72 examples, 0 failures.

No behaviour change.

- Remove the unused one-shot decompress path: zstd_decompress, its
  decompress_wrapper, and the decompress_params struct in common.h, plus
  decompress_buffered in zstdruby.c. Nothing calls them since decompress
  was rewritten around decode_one_frame/ZSTD_decompressStream; the
  streaming wrapper (stream_decompress_wrapper) is unaffected.
- rb_ddict_alloc declared its pointer as ZSTD_CDict* though it wraps a
  DDict; correct it to ZSTD_DDict* (it is NULL here, so the wrong type
  name was cosmetic).
- set_decompress_params raised "ZSTD_CCtx_loadDictionary failed" on a
  DDict load error; correct it to ZSTD_DCtx_loadDictionary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant