Skip to content

Commit

Permalink
Test commit for clang
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimes committed Aug 25, 2024
1 parent cf459bc commit f30ff60
Show file tree
Hide file tree
Showing 5 changed files with 1,000 additions and 1,003 deletions.
1 change: 0 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# A clang-format style that approximates Python's PEP 7
# Useful for IDE integration
BasedOnStyle: LLVM
IndentWidth: 4
Language: Cpp
PointerAlignment: Right
ReflowComments: true
Expand Down
43 changes: 21 additions & 22 deletions src/mmh3/hashlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,26 @@
* on any errors, e.g. 'return NULL' or 'goto error'.
*/
#define GET_BUFFER_VIEW_OR_ERROR(obj, viewp, erraction) \
do { \
if (PyUnicode_Check((obj))) { \
PyErr_SetString(PyExc_TypeError, \
"Strings must be encoded before hashing"); \
erraction; \
} \
if (!PyObject_CheckBuffer((obj))) { \
PyErr_SetString(PyExc_TypeError, \
"object supporting the buffer API required"); \
erraction; \
} \
if (PyObject_GetBuffer((obj), (viewp), PyBUF_SIMPLE) == -1) { \
erraction; \
} \
if ((viewp)->ndim > 1) { \
PyErr_SetString(PyExc_BufferError, \
"Buffer must be single dimension"); \
PyBuffer_Release((viewp)); \
erraction; \
} \
} while (0)
do { \
if (PyUnicode_Check((obj))) { \
PyErr_SetString(PyExc_TypeError, \
"Strings must be encoded before hashing"); \
erraction; \
} \
if (!PyObject_CheckBuffer((obj))) { \
PyErr_SetString(PyExc_TypeError, \
"object supporting the buffer API required"); \
erraction; \
} \
if (PyObject_GetBuffer((obj), (viewp), PyBUF_SIMPLE) == -1) { \
erraction; \
} \
if ((viewp)->ndim > 1) { \
PyErr_SetString(PyExc_BufferError, "Buffer must be single dimension"); \
PyBuffer_Release((viewp)); \
erraction; \
} \
} while (0)

#define GET_BUFFER_VIEW_OR_ERROUT(obj, viewp) \
GET_BUFFER_VIEW_OR_ERROR(obj, viewp, return NULL)
GET_BUFFER_VIEW_OR_ERROR(obj, viewp, return NULL)
Loading

0 comments on commit f30ff60

Please sign in to comment.