chiark / gitweb /
sd-dhcp: generalise ip header generation
[elogind.git] / src / python-systemd / id128.c
index 1c2fe5dd0b2fa4cc62d8f16f18e07b493d289b77..6dadf7b2fd14d3770a73e9ccbf6a239afa702eb3 100644 (file)
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include <stdbool.h>
-
 #include <Python.h>
 
 #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"
@@ -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
 
@@ -138,6 +139,7 @@ static struct PyModuleDef 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