Commit 4cc10e7
committed
compressor/zstd: modernize ZSTD API usage in ZstdCompressor
Update ZstdCompressor to use the modern ZSTD compression context API
and improve error handling:
- Replace deprecated ZSTD_createCStream() with ZSTD_createCCtx()
- Use ZSTD_CCtx_reset() with ZSTD_reset_session_and_parameters flag
instead of separate ZSTD_reset_session_only and ZSTD_CCtx_refCDict()
calls. This consolidates session and parameter reset into a single
operation.
- Add proper return value checking for all ZSTD API calls using
ZSTD_isError() to catch compression failures
- Ensure proper cleanup with ZSTD_freeCCtx() on all error paths to
prevent memory leaks
- Update corresponding free function from ZSTD_freeCStream() to
ZSTD_freeCCtx()
These changes align with ZSTD's recommended API usage patterns and
improve robustness by properly handling potential compression errors.
Fixes: https://tracker.ceph.com/issues/73522
Signed-off-by: Edwin Rodriguez <[email protected]>1 parent 6282e42 commit 4cc10e7
1 file changed
+22
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
33 | 50 | | |
34 | 51 | | |
35 | 52 | | |
| |||
49 | 66 | | |
50 | 67 | | |
51 | 68 | | |
52 | | - | |
| 69 | + | |
| 70 | + | |
53 | 71 | | |
54 | 72 | | |
55 | 73 | | |
56 | 74 | | |
57 | | - | |
| 75 | + | |
58 | 76 | | |
59 | 77 | | |
60 | 78 | | |
| |||
0 commit comments