8000 Remove extraneous `(char *)` casts. · matplotlib/matplotlib@2d2083c · GitHub
[go: up one dir, main page]

Skip to content

Commit 2d2083c

Browse files
committed
Remove extraneous (char *) casts.
These functions all take `const char *` already, or return `char *` directly.
1 parent 8627f64 commit 2d2083c

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

src/_image_wrapper.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ _get_transform_mesh(PyObject *py_affine, npy_intp *dims)
6767
out_dims[0] = dims[0] * dims[1];
6868
out_dims[1] = 2;
6969

70-
py_inverse = PyObject_CallMethod(
71-
py_affine, (char *)"inverted", (char *)"", NULL);
70+
py_inverse = PyObject_CallMethod(py_affine, "inverted", NULL);
7271
if (py_inverse == NULL) {
7372
return NULL;
7473
}
@@ -83,10 +82,8 @@ _get_transform_mesh(PyObject *py_affine, npy_intp *dims)
8382
}
8483
}
8584

86-
PyObject *output_mesh =
87-
PyObject_CallMethod(
88-
py_inverse, (char *)"transform", (char *)"O",
89-
(char *)input_mesh.pyobj_steal(), NULL);
85+
PyObject *output_mesh = PyObject_CallMethod(
86+
py_inverse, "transform", "O", input_mesh.pyobj_steal());
9087

9188
Py_DECREF(py_inverse);
9289

src/mplutils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ int add_dict_int(PyObject *dict, const char *key, long val)
1010
return 1;
1111
}
1212

13-
if (PyDict_SetItemString(dict, (char *)key, valobj)) {
13+
if (PyDict_SetItemString(dict, key, valobj)) {
1414
Py_DECREF(valobj);
1515
return 1;
1616
}

src/numpy_cpp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ class array_view : public detail::array_view_accessors<array_view, T, ND>
406406
Py_XINCREF(arr);
407407
m_shape = PyArray_DIMS(m_arr);
408408
m_strides = PyArray_STRIDES(m_arr);
409-
m_data = (char *)PyArray_BYTES(m_arr);
409+
m_data = PyArray_BYTES(m_arr);
410410
}
411411

412412
array_view(npy_intp shape[ND]) : m_arr(NULL), m_shape(NULL), m_strides(NULL), m_data(NULL)
@@ -486,7 +486,7 @@ class array_view : public detail::array_view_accessors<array_view, T, ND>
486486
m_arr = tmp;
487487
m_shape = PyArray_DIMS(m_arr);
488488
m_strides = PyArray_STRIDES(m_arr);
489-
m_data = (char *)PyArray_BYTES(tmp);
489+
m_data = PyArray_BYTES(tmp);
490490
}
491491

492492
return true;

src/py_converters.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ int convert_from_method(PyObject *obj, const char *name, converter func, void *p
5454
{
5555
PyObject *value;
5656

57-
value = PyObject_CallMethod(obj, (char *)name, NULL);
57+
value = PyObject_CallMethod(obj, name, NULL);
5858
if (value == NULL) {
59-
if (!PyObject_HasAttrString(obj, (char *)name)) {
59+
if (!PyObject_HasAttrString(obj, name)) {
6060
PyErr_Clear();
6161
return 1;
6262
}
@@ -76,9 +76,9 @@ int convert_from_attr(PyObject *obj, const char *name, converter func, void *p)
7676
{
7777
PyObject *value;
7878

79-
value = PyObject_GetAttrString(obj, (char *)name);
79+
value = PyObject_GetAttrString(obj, name);
8080
if (value == NULL) {
81-
if (!PyObject_HasAttrString(obj, (char *)name)) {
81+
if (!PyObject_HasAttrString(obj, name)) {
8282
PyErr_Clear();
8383
return 1;
8484
}

0 commit comments

Comments
 (0)
0