Cleanup: remove redundant double parenthesis

This commit is contained in:
2022-09-25 15:14:13 +10:00
parent 865894481c
commit c9e35c2ced
125 changed files with 194 additions and 196 deletions

View File

@@ -732,7 +732,7 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
if (PyLong_Check(length_ob)) {
ndimensions = 1;
if (((dimensions[0] = PyLong_AsLong(length_ob)) < 1)) {
if ((dimensions[0] = PyLong_AsLong(length_ob)) < 1) {
PyErr_SetString(PyExc_AttributeError,
"dimensions must be between 1 and " STRINGIFY(MAX_DIMENSIONS));
return NULL;

View File

@@ -61,7 +61,7 @@ static bool pygpu_buffer_pyobj_as_shape(PyObject *shape_obj,
Py_ssize_t shape_len = 0;
if (PyLong_Check(shape_obj)) {
shape_len = 1;
if (((r_shape[0] = PyLong_AsLong(shape_obj)) < 1)) {
if ((r_shape[0] = PyLong_AsLong(shape_obj)) < 1) {
PyErr_SetString(PyExc_AttributeError, "dimension must be greater than or equal to 1");
return false;
}

View File

@@ -424,7 +424,7 @@ static PyObject *app_translations_contexts_make(void)
}
#define SetObjString(item) \
PyStructSequence_SET_ITEM(translations_contexts, pos++, PyUnicode_FromString((item)))
PyStructSequence_SET_ITEM(translations_contexts, pos++, PyUnicode_FromString(item))
#define SetObjNone() \
PyStructSequence_SET_ITEM(translations_contexts, pos++, Py_INCREF_RET(Py_None))

View File

@@ -225,7 +225,7 @@ static void bpy_pydriver_namespace_update_depsgraph(struct Depsgraph *depsgraph)
}
if ((g_pydriver_state_prev.depsgraph == NULL) ||
((depsgraph != g_pydriver_state_prev.depsgraph->ptr.data))) {
(depsgraph != g_pydriver_state_prev.depsgraph->ptr.data)) {
PyObject *item = bpy_pydriver_depsgraph_as_pyobject(depsgraph);
PyDict_SetItem(bpy_pydriver_Dict, bpy_intern_str_depsgraph, item);
Py_DECREF(item);

View File

@@ -394,7 +394,7 @@ static int bpy_prop_array_length_parse(PyObject *o, void *p)
if (PyLong_CheckExact(o)) {
int size;
if (((size = PyLong_AsLong(o)) == -1)) {
if ((size = PyLong_AsLong(o)) == -1) {
PyErr_Format(
PyExc_ValueError, "expected number or sequence of numbers, got %s", Py_TYPE(o)->tp_name);
return 0;
@@ -427,7 +427,7 @@ static int bpy_prop_array_length_parse(PyObject *o, void *p)
PyObject **seq_items = PySequence_Fast_ITEMS(seq_fast);
for (int i = 0; i < seq_len; i++) {
int size;
if (((size = PyLong_AsLong(seq_items[i])) == -1)) {
if ((size = PyLong_AsLong(seq_items[i])) == -1) {
Py_DECREF(seq_fast);
PyErr_Format(PyExc_ValueError,
"expected number in sequence, got %s at index %d",

View File

@@ -47,8 +47,7 @@ static int mathutils_array_parse_fast(float *array,
i = size;
do {
i--;
if (((array[i] = PyFloat_AsDouble((item = value_fast_items[i]))) == -1.0f) &&
PyErr_Occurred()) {
if (((array[i] = PyFloat_AsDouble(item = value_fast_items[i])) == -1.0f) && PyErr_Occurred()) {
PyErr_Format(PyExc_TypeError,
"%.200s: sequence index %d expected a number, "
"found '%.200s' type, ",
@@ -317,7 +316,7 @@ int mathutils_int_array_parse(int *array, int array_dim, PyObject *value, const
i = size;
while (i > 0) {
i--;
if (((array[i] = PyC_Long_AsI32((item = value_fast_items[i]))) == -1) && PyErr_Occurred()) {
if (((array[i] = PyC_Long_AsI32(item = value_fast_items[i])) == -1) && PyErr_Occurred()) {
PyErr_Format(PyExc_TypeError, "%.200s: sequence index %d expected an int", error_prefix, i);
size = -1;
break;

View File

@@ -32,10 +32,10 @@ static const char *euler_order_str(EulerObject *self)
short euler_order_from_string(const char *str, const char *error_prefix)
{
if ((str[0] && str[1] && str[2] && str[3] == '\0')) {
if (str[0] && str[1] && str[2] && str[3] == '\0') {
#ifdef __LITTLE_ENDIAN__
# define MAKE_ID3(a, b, c) (((a)) | ((b) << 8) | ((c) << 16))
# define MAKE_ID3(a, b, c) ((a) | ((b) << 8) | ((c) << 16))
#else
# define MAKE_ID3(a, b, c) (((a) << 24) | ((b) << 16) | ((c) << 8))
#endif

View File

@@ -1177,7 +1177,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
}
}
else if (quat1) { /* QUAT * FLOAT */
if ((((scalar = PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred()) == 0)) {
if (((scalar = PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred()) == 0) {
return quat_mul_float(quat1, scalar);
}
}