Skip to content

Commit 0ecb1ff

Browse files
committed
Remove decompress_impl param max_length
1 parent 9e3ae05 commit 0ecb1ff

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

Modules/_zstd/decompressor.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -275,24 +275,16 @@ _zstd_load_d_dict(ZstdDecompressor *self, PyObject *dict)
275275
*/
276276
static PyObject *
277277
decompress_impl(ZstdDecompressor *self, ZSTD_inBuffer *in,
278-
Py_ssize_t max_length,
279-
Py_ssize_t initial_size)
278+
Py_ssize_t max_length)
280279
{
281280
size_t zstd_ret;
282281
ZSTD_outBuffer out;
283282
_BlocksOutputBuffer buffer = {.list = NULL};
284283
PyObject *ret;
285284

286285
/* Initialize the output buffer */
287-
if (initial_size >= 0) {
288-
if (_OutputBuffer_InitWithSize(&buffer, &out, max_length, initial_size) < 0) {
289-
goto error;
290-
}
291-
}
292-
else {
293-
if (_OutputBuffer_InitAndGrow(&buffer, &out, max_length) < 0) {
294-
goto error;
295-
}
286+
if (_OutputBuffer_InitAndGrow(&buffer, &out, max_length) < 0) {
287+
goto error;
296288
}
297289
assert(out.pos == 0);
298290

@@ -375,7 +367,6 @@ decompressor_reset_session(ZstdDecompressor *self)
375367
static PyObject *
376368
stream_decompress(ZstdDecompressor *self, Py_buffer *data, Py_ssize_t max_length)
377369
{
378-
Py_ssize_t initial_buffer_size = -1;
379370
ZSTD_inBuffer in;
380371
PyObject *ret = NULL;
381372
int use_input_buffer;
@@ -471,7 +462,7 @@ stream_decompress(ZstdDecompressor *self, Py_buffer *data, Py_ssize_t max_length
471462
assert(in.pos == 0);
472463

473464
/* Decompress */
474-
ret = decompress_impl(self, &in, max_length, initial_buffer_size);
465+
ret = decompress_impl(self, &in, max_length);
475466
if (ret == NULL) {
476467
goto error;
477468
}

0 commit comments

Comments
 (0)