X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fpython-systemd%2Fid128.c;h=5ec7309a54a94bef1857d2bf4715ff98c0dff065;hb=1d050e1e0a7082e23ee9b31fa0b819cb332b3444;hp=a6711a5bd5f6b6a24f00a0eaf80a979a312d601e;hpb=37d3ab1b7e114f0fb6dfb2e7273569b42794b76a;p=elogind.git diff --git a/src/python-systemd/id128.c b/src/python-systemd/id128.c index a6711a5bd..5ec7309a5 100644 --- a/src/python-systemd/id128.c +++ b/src/python-systemd/id128.c @@ -19,13 +19,14 @@ along with systemd; If not, see . ***/ -#include - #include -#include +#include "systemd/sd-messages.h" #include "pyutil.h" +#include "log.h" +#include "util.h" +#include "macro.h" PyDoc_STRVAR(module__doc__, "Python interface to the libsystemd-id128 library.\n\n" @@ -52,9 +53,9 @@ PyDoc_STRVAR(get_boot__doc__, ); static PyObject* make_uuid(sd_id128_t id) { - PyObject _cleanup_Py_DECREF_ + _cleanup_Py_DECREF_ PyObject *uuid = NULL, *UUID = NULL, *bytes = NULL, - *args = NULL, *kwargs = NULL, *obj = NULL; + *args = NULL, *kwargs = NULL; uuid = PyImport_ImportModule("uuid"); if (!uuid) @@ -110,11 +111,9 @@ static int add_id(PyObject *module, const char* name, sd_id128_t id) { return PyModule_AddObject(module, name, obj); } -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmissing-prototypes" - #if PY_MAJOR_VERSION < 3 +DISABLE_WARNING_MISSING_PROTOTYPES; PyMODINIT_FUNC initid128(void) { PyObject *m; @@ -126,7 +125,9 @@ PyMODINIT_FUNC initid128(void) { #define JOINER ; #include "id128-constants.h" #undef JOINER + PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION); } +REENABLE_WARNING; #else @@ -134,10 +135,11 @@ static struct PyModuleDef module = { PyModuleDef_HEAD_INIT, "id128", /* name of module */ module__doc__, /* module documentation, may be NULL */ - 0, /* size of per-interpreter state of the module */ + -1, /* size of per-interpreter state of the module */ methods }; +DISABLE_WARNING_MISSING_PROTOTYPES; PyMODINIT_FUNC PyInit_id128(void) { PyObject *m; @@ -149,14 +151,13 @@ PyMODINIT_FUNC PyInit_id128(void) { #define JOINER || #include "id128-constants.h" #undef JOINER - false) { + PyModule_AddStringConstant(m, "__version__", PACKAGE_VERSION)) { Py_DECREF(m); return NULL; } return m; } +REENABLE_WARNING; #endif - -#pragma GCC diagnostic pop