} Monitor;
static PyTypeObject MonitorType;
-static void Monitor_dealloc(Monitor* self)
-{
+static void Monitor_dealloc(Monitor* self) {
sd_login_monitor_unref(self->monitor);
Py_TYPE(self)->tp_free((PyObject*)self);
}
"descriptor which can be integrated in an external event loop.\n"
"See man:sd_login_monitor_new(3) for the details about what\n"
"can be monitored.");
-static int Monitor_init(Monitor *self, PyObject *args, PyObject *keywds)
-{
+static int Monitor_init(Monitor *self, PyObject *args, PyObject *keywds) {
const char *category = NULL;
int r;
"fileno() -> int\n\n"
"Get a file descriptor to poll for events.\n"
"This method wraps sd_login_monitor_get_fd(3).");
-static PyObject* Monitor_fileno(Monitor *self, PyObject *args)
-{
+static PyObject* Monitor_fileno(Monitor *self, PyObject *args) {
int fd = sd_login_monitor_get_fd(self->monitor);
set_error(fd, NULL, NULL);
if (fd < 0)
"Returns a mask of poll() events to wait for on the file\n"
"descriptor returned by .fileno().\n\n"
"See man:sd_login_monitor_get_events(3) for further discussion.");
-static PyObject* Monitor_get_events(Monitor *self, PyObject *args)
-{
+static PyObject* Monitor_get_events(Monitor *self, PyObject *args) {
int r = sd_login_monitor_get_events(self->monitor);
set_error(r, NULL, NULL);
if (r < 0)
"The return value must be converted to a relative timeout in\n"
"milliseconds if it is to be used as an argument for poll().\n"
"See man:sd_login_monitor_get_timeout(3) for further discussion.");
-static PyObject* Monitor_get_timeout(Monitor *self, PyObject *args)
-{
+static PyObject* Monitor_get_timeout(Monitor *self, PyObject *args) {
int r;
uint64_t t;
"Returns a timeout value suitable for usage in poll(), the value\n"
"returned by .get_timeout() converted to relative ms, or -1 if\n"
"no timeout is necessary.");
-static PyObject* Monitor_get_timeout_ms(Monitor *self, PyObject *args)
-{
+static PyObject* Monitor_get_timeout_ms(Monitor *self, PyObject *args) {
int r;
uint64_t t;
"Free resources allocated by this Monitor object.\n"
"This method invokes sd_login_monitor_unref().\n"
"See man:sd_login_monitor_unref(3).");
-static PyObject* Monitor_close(Monitor *self, PyObject *args)
-{
+static PyObject* Monitor_close(Monitor *self, PyObject *args) {
assert(self);
assert(!args);
"Reset the wakeup state of the monitor object.\n"
"This method invokes sd_login_monitor_flush().\n"
"See man:sd_login_monitor_flush(3).");
-static PyObject* Monitor_flush(Monitor *self, PyObject *args)
-{
+static PyObject* Monitor_flush(Monitor *self, PyObject *args) {
assert(self);
assert(!args);
"__enter__() -> self\n\n"
"Part of the context manager protocol.\n"
"Returns self.\n");
-static PyObject* Monitor___enter__(PyObject *self, PyObject *args)
-{
+static PyObject* Monitor___enter__(PyObject *self, PyObject *args) {
assert(self);
assert(!args);
"__exit__(type, value, traceback) -> None\n\n"
"Part of the context manager protocol.\n"
"Closes the monitor..\n");
-static PyObject* Monitor___exit__(Monitor *self, PyObject *args)
-{
+static PyObject* Monitor___exit__(Monitor *self, PyObject *args) {
return Monitor_close(self, args);
}
.tp_new = PyType_GenericNew,
};
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-
#if PY_MAJOR_VERSION < 3
+DISABLE_WARNING_MISSING_PROTOTYPES;
PyMODINIT_FUNC initlogin(void) {
PyObject *m;
Py_INCREF(&MonitorType);
PyModule_AddObject(m, "Monitor", (PyObject *) &MonitorType);
}
+REENABLE_WARNING;
+
#else
static struct PyModuleDef module = {
methods
};
+DISABLE_WARNING_MISSING_PROTOTYPES;
PyMODINIT_FUNC PyInit_login(void) {
PyObject *m;
return m;
}
+REENABLE_WARNING;
#endif
-
-#pragma GCC diagnostic pop