diff options
author | 2022-11-09 10:16:27 +0000 | |
---|---|---|
committer | 2022-11-23 23:43:51 +0000 | |
commit | 38fcfd22dd8bd6cbecdd6327523d65b042389cc9 (patch) | |
tree | d5780b3c955a6243bfaca3f27c2383601b31102d | |
parent | depgraph: Resolve atoms using the correct root (diff) | |
download | portage-38fcfd22dd8bd6cbecdd6327523d65b042389cc9.tar.gz portage-38fcfd22dd8bd6cbecdd6327523d65b042389cc9.tar.bz2 portage-38fcfd22dd8bd6cbecdd6327523d65b042389cc9.zip |
src: use designated initialiser syntax for PyModuleDef
It's far easier to keep track of the arguments this way.
Closes: https://github.com/gentoo/portage/pull/940
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | src/portage_util_file_copy_reflink_linux.c | 21 | ||||
-rw-r--r-- | src/portage_util_libc.c | 27 |
3 files changed, 27 insertions, 23 deletions
@@ -10,6 +10,8 @@ Features: * cleanups: Drop long-obsolete Jython compatibility code. +* cleanups: Use designated initializer syntax in src/ (C bits). + * Add support for a distinct SYSROOT location that is not equal to / or ROOT. This is only expected to be used for cross-bootstrapping a new system from scratch using a crossdev environment under /usr/${CHOST}. diff --git a/src/portage_util_file_copy_reflink_linux.c b/src/portage_util_file_copy_reflink_linux.c index b00b57952..f0badc0e9 100644 --- a/src/portage_util_file_copy_reflink_linux.c +++ b/src/portage_util_file_copy_reflink_linux.c @@ -16,25 +16,20 @@ static PyObject * _reflink_linux_file_copy(PyObject *, PyObject *); static PyMethodDef reflink_linuxMethods[] = { { - "file_copy", - _reflink_linux_file_copy, - METH_VARARGS, - "Copy between two file descriptors, " - "with reflink and sparse file support." + .ml_name = "file_copy", + .ml_meth = _reflink_linux_file_copy, + .ml_flags = METH_VARARGS, + .ml_doc = "Copy between two file descriptors with reflink and sparse file support." }, {NULL, NULL, 0, NULL} }; static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, - "reflink_linux", /* m_name */ - "Module for reflink_linux copy operations", /* m_doc */ - -1, /* m_size */ - reflink_linuxMethods, /* m_methods */ - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + .m_name = "reflink_linux", + .m_doc = "Module for reflink_linux copy operations", + .m_size = -1, + .m_methods = reflink_linuxMethods, }; PyMODINIT_FUNC diff --git a/src/portage_util_libc.c b/src/portage_util_libc.c index 2a3e624dc..12b2440c7 100644 --- a/src/portage_util_libc.c +++ b/src/portage_util_libc.c @@ -10,21 +10,28 @@ static PyObject * _libc_tolower(PyObject *, PyObject *); static PyObject * _libc_toupper(PyObject *, PyObject *); static PyMethodDef LibcMethods[] = { - {"tolower", _libc_tolower, METH_VARARGS, "Convert to lower case using system locale."}, - {"toupper", _libc_toupper, METH_VARARGS, "Convert to upper case using system locale."}, + { + .ml_name = "tolower", + .ml_meth = _libc_tolower, + .ml_flags = METH_VARARGS, + .ml_doc = "Convert to lower case using system locale." + + }, + { + .ml_name = "toupper", + .ml_meth = _libc_toupper, + .ml_flags = METH_VARARGS, + .ml_doc = "Convert to upper case using system locale." + }, {NULL, NULL, 0, NULL} }; static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, - "libc", /* m_name */ - "Module for converting case using the system locale", /* m_doc */ - -1, /* m_size */ - LibcMethods, /* m_methods */ - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL, /* m_free */ + .m_name = "libc", + .m_doc = "Module for converting case using the system locale", + .m_size = -1, + .m_methods = LibcMethods, }; PyMODINIT_FUNC |