Skip to content

Commit da35da5

Browse files
committed
Simplify error handling in _get_frame_size
1 parent 782dbc1 commit da35da5

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

Modules/_zstd/_zstdmodule.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ _zstd_get_frame_size_impl(PyObject *module, Py_buffer *frame_buffer)
465465
/*[clinic end generated code: output=a7384c2f8780f442 input=7d3ad24311893bf3]*/
466466
{
467467
size_t frame_size;
468-
PyObject *ret;
469468

470469
frame_size = ZSTD_findFrameCompressedSize(frame_buffer->buf, frame_buffer->len);
471470
if (ZSTD_isError(frame_size)) {
@@ -476,19 +475,10 @@ _zstd_get_frame_size_impl(PyObject *module, Py_buffer *frame_buffer)
476475
"beginning of a frame, and its length not less than this "
477476
"complete frame. Zstd error message: %s.",
478477
ZSTD_getErrorName(frame_size));
479-
goto error;
480-
}
481-
482-
ret = PyLong_FromSize_t(frame_size);
483-
if (ret == NULL) {
484-
goto error;
478+
return NULL;
485479
}
486-
goto success;
487480

488-
error:
489-
ret = NULL;
490-
success:
491-
return ret;
481+
return PyLong_FromSize_t(frame_size);
492482
}
493483

494484
/*[clinic input]

0 commit comments

Comments
 (0)