Skip to content

Commit

Permalink
delete the body
Browse files Browse the repository at this point in the history
  • Loading branch information
oconnor663 committed Feb 1, 2024
1 parent 51a03f4 commit bb633d3
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions c_impl/blake3module.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,41 +244,6 @@ static PyObject *Blake3_update_mmap(Blake3Object *self, PyObject *args,

PyThreadState *thread_state;
Blake3_release_gil_and_lock_self(self, &thread_state);

file = fopen(PyBytes_AS_STRING(path_bytes), "r");
if (!file) {
PyErr_SetFromErrno(PyExc_OSError);
goto exit;
}

char *buf[BUFSIZE];
while (1) {
size_t n = fread(buf, sizeof(char), BUFSIZE, file);
if (ferror(file)) {
PyErr_SetFromErrno(PyExc_OSError);
goto exit;
}
blake3_hasher_update(&self->hasher, buf, n);
if (feof(file)) {
break;
}
}

int fclose_ret = fclose(file);
file = NULL;
if (fclose_ret != 0) {
PyErr_SetFromErrno(PyExc_OSError);
goto exit;
}

// success
Py_INCREF(Py_None);
ret = Py_None;

exit:
if (file) {
fclose(file);
}
Blake3_unlock_self_and_acquire_gil(self, &thread_state);
Py_XDECREF(path_bytes);
return ret;
Expand Down

0 comments on commit bb633d3

Please sign in to comment.