8000 Remove unnecessary extern "C". · matplotlib/matplotlib@c7987f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit c7987f1

Browse files
committed
Remove unnecessary extern "C".
There's no need for it on static structs, and the `PyMODINIT_FUNC` macro adds it already for the init function.
1 parent 39fab5e commit c7987f1

File tree

6 files changed

+43
-66
lines changed

6 files changed

+43
-66
lines changed

src/_backend_agg_wrapper.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,6 @@ static PyTypeObject *PyRendererAgg_init_type(PyObject *m, PyTypeObject *type)
660660
return type;
661661
}
662662

663-
extern "C" {
664-
665663
static struct PyModuleDef moduledef = {
666664
PyModuleDef_HEAD_INIT,
667665
"_backend_agg",
@@ -696,5 +694,3 @@ PyMODINIT_FUNC PyInit__backend_agg(void)
696694

697695
return m;
698696
}
699-
700-
} // extern "C"

src/_contour_wrapper.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ static PyTypeObject* PyQuadContourGenerator_init_type(PyObject* m, PyTypeObject*
152152

153153
/* Module */
154154

155-
extern "C" {
156-
157155
static struct PyModuleDef moduledef = {
158156
PyModuleDef_HEAD_INIT,
159157
"_contour",
@@ -184,5 +182,3 @@ PyMODINIT_FUNC PyInit__contour(void)
184182

185183
return m;
186184
}
187-
188-
} // extern "C"

src/_image_wrapper.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,6 @@ static PyMethodDef module_functions[] = {
434434
{NULL}
435435
};
436436

437-
extern "C" {
438-
439437
static struct PyModuleDef moduledef = {
440438
PyModuleDef_HEAD_INIT,
441439
"_image",
@@ -483,5 +481,3 @@ PyMODINIT_FUNC PyInit__image(void)
483481

484482
return m;
485483
}
486-
487-
} // extern "C"

src/_path_wrapper.cpp

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -819,53 +819,50 @@ static PyObject *Py_is_sorted(PyObject *self, PyObject *obj)
819819
}
820820

821821

822-
extern "C" {
823-
824-
static PyMethodDef module_functions[] = {
825-
{"point_in_path", (PyCFunction)Py_point_in_path, METH_VARARGS, Py_point_in_path__doc__},
826-
{"points_in_path", (PyCFunction)Py_points_in_path, METH_VARARGS, Py_points_in_path__doc__},
827-
{"point_on_path", (PyCFunction)Py_point_on_path, METH_VARARGS, Py_point_on_path__doc__},
828-
{"points_on_path", (PyCFunction)Py_points_on_path, METH_VARARGS, Py_points_on_path__doc__},
829-
{"get_path_extents", (PyCFunction)Py_get_path_extents, METH_VARARGS, Py_get_path_extents__doc__},
830-
{"update_path_extents", (PyCFunction)Py_update_path_extents, METH_VARARGS, Py_update_path_extents__doc__},
831-
{"get_path_collection_extents", (PyCFunction)Py_get_path_collection_extents, METH_VARARGS, Py_get_path_collection_extents__doc__},
832-
{"point_in_path_collection", (PyCFunction)Py_point_in_path_collection, METH_VARARGS, Py_point_in_path_collection__doc__},
833-
{"path_in_path", (PyCFunction)Py_path_in_path, METH_VARARGS, Py_path_in_path__doc__},
834-
{"clip_path_to_rect", (PyCFunction)Py_clip_path_to_rect, METH_VARARGS, Py_clip_path_to_rect__doc__},
835-
{"affine_transform", (PyCFunction)Py_affine_transform, METH_VARARGS, Py_affine_transform__doc__},
836-
{"count_bboxes_overlapping_bbox", (PyCFunction)Py_count_bboxes_overlapping_bbox, METH_VARARGS, Py_count_bboxes_overlapping_bbox__doc__},
837-
{"path_intersects_path", (PyCFunction)Py_path_intersects_path, METH_VARARGS|METH_KEYWORDS, Py_path_intersects_path__doc__},
838-
{"path_intersects_rectangle", (PyCFunction)Py_path_intersects_rectangle, METH_VARARGS|METH_KEYWORDS, Py_path_intersects_rectangle__doc__},
839-
{"convert_path_to_polygons", (PyCFunction)Py_convert_path_to_polygons, METH_VARARGS|METH_KEYWORDS, Py_convert_path_to_polygons__doc__},
840-
{"cleanup_path", (PyCFunction)Py_cleanup_path, METH_VARARGS, Py_cleanup_path__doc__},
841-
{"convert_to_string", (PyCFunction)Py_convert_to_string, METH_VARARGS, Py_convert_to_string__doc__},
842-
{"is_sorted", (PyCFunction)Py_is_sorted, METH_O, Py_is_sorted__doc__},
843-
{NULL}
844-
};
845-
846-
static struct PyModuleDef moduledef = {
847-
PyModuleDef_HEAD_INIT,
848-
"_path",
849-
NULL,
850-
0,
851-
module_functions,
852-
NULL,
853-
NULL,
854-
NULL,
855-
NULL
856-
};
857-
858-
PyMODINIT_FUNC PyInit__path(void)
859-
{
860-
PyObject *m;
861-
m = PyModule_Create(&moduledef);
822+
static PyMethodDef module_functions[] = {
823+
{"point_in_path", (PyCFunction)Py_point_in_path, METH_VARARGS, Py_point_in_path__doc__},
824+
{"points_in_path", (PyCFunction)Py_points_in_path, METH_VARARGS, Py_points_in_path__doc__},
825+
{"point_on_path", (PyCFunction)Py_point_on_path, METH_VARARGS, Py_point_on_path__doc__},
826+
{"points_on_path", (PyCFunction)Py_points_on_path, METH_VARARGS, Py_points_on_path__doc__},
827+
{"get_path_extents", (PyCFunction)Py_get_path_extents, METH_VARARGS, Py_get_path_extents__doc__},
828+
{"update_path_extents", (PyCFunction)Py_update_path_extents, METH_VARARGS, Py_update_path_extents__doc__},
829+
{"get_path_collection_extents", (PyCFunction)Py_get_path_collection_extents, METH_VARARGS, Py_get_path_collection_extents__doc__},
830+
{"point_in_path_collection", (PyCFunction)Py_point_in_path_collection, METH_VARARGS, Py_point_in_path_collection__doc__},
831+
{"path_in_path", (PyCFunction)Py_path_in_path, METH_VARARGS, Py_path_in_path__doc__},
832+
{"clip_path_to_rect", (PyCFunction)Py_clip_path_to_rect, METH_VARARGS, Py_clip_path_to_rect__doc__},
833+
{"affine_transform", (PyCFunction)Py_affine_transform, METH_VARARGS, Py_affine_transform__doc__},
834+
{"count_bboxes_overlapping_bbox", (PyCFunction)Py_count_bboxes_overlapping_bbox, METH_VARARGS, Py_count_bboxes_overlapping_bbox__doc__},
835+
{"path_intersects_path", (PyCFunction)Py_path_intersects_path, METH_VARARGS|METH_KEYWORDS, Py_path_intersects_path__doc__},
836+
{"path_intersects_rectangle", (PyCFunction)Py_path_intersects_rectangle, METH_VARARGS|METH_KEYWORDS, Py_path_intersects_rectangle__doc__},
837+
{"convert_path_to_polygons", (PyCFunction)Py_convert_path_to_polygons, METH_VARARGS|METH_KEYWORDS, Py_convert_path_to_polygons__doc__},
838+
{"cleanup_path", (PyCFunction)Py_cleanup_path, METH_VARARGS, Py_cleanup_path__doc__},
839+
{"convert_to_string", (PyCFunction)Py_convert_to_string, METH_VARARGS, Py_convert_to_string__doc__},
840+
{"is_sorted", (PyCFunction)Py_is_sorted, METH_O, Py_is_sorted__doc__},
841+
{NULL}
842+
};
843+
844+
static struct PyModuleDef moduledef = {
845+
PyModuleDef_HEAD_INIT,
846+
"_path",
847+
NULL,
848+
0,
849+
module_functions,
850+
NULL,
851+
NULL,
852+
NULL,
853+
NULL
854+
};
855+
856+
PyMODINIT_FUNC PyInit__path(void)
857+
{
858+
PyObject *m;
859+
m = PyModule_Create(&moduledef);
862860

863-
if (m == NULL) {
864-
return NULL;
865-
}
861+
if (m == NULL) {
862+
return NULL;
863+
}
866864

867-
import_array();
865+
import_array();
868866

869-
return m;
870-
}
867+
return m;
871868
}

src/ft2font_wrapper.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,8 +1708,6 @@ static PyTypeObject *PyFT2Font_init_type(PyObject *m, PyTypeObject *type)
17081708
return type;
17091709
}
17101710

1711-
extern "C" {
1712-
17131711
static struct PyModuleDef moduledef = {
17141712
PyModuleDef_HEAD_INIT,
17151713
"ft2font",
@@ -1812,5 +1810,3 @@ PyMODINIT_FUNC PyInit_ft2font(void)
18121810

18131811
return m;
18141812
}
1815-
1816-
} // extern "C"

src/tri/_tri_wrapper.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,6 @@ static PyTypeObject* PyTrapezoidMapTriFinder_init_type(PyObject* m, PyTypeObject
492492

493493
/* Module */
494494

495-
extern "C" {
496-
497495
static struct PyModuleDef moduledef = {
498496
PyModuleDef_HEAD_INIT,
499497
"_tri",
@@ -530,5 +528,3 @@ PyMODINIT_FUNC PyInit__tri(void)
530528

531529
return m;
532530
}
533-
534-
} // extern "C"

0 commit comments

Comments
 (0)
0