diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-05-09 18:25:54 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-05-09 18:28:23 -0400 |
commit | 04b33f69b6fba648b0d48aca03b9310b3cfdb02d (patch) | |
tree | f5956dbaf850367c48adc9ee7ee5101539c49f85 /src/python-systemd/pyutil.c | |
parent | 77b6e19458f37cfde127ec6aa9494c0ac45ad890 (diff) |
systemd-python: use consistent indentation
Diffstat (limited to 'src/python-systemd/pyutil.c')
-rw-r--r-- | src/python-systemd/pyutil.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/python-systemd/pyutil.c b/src/python-systemd/pyutil.c index 2f047e643a..42e7ba72cf 100644 --- a/src/python-systemd/pyutil.c +++ b/src/python-systemd/pyutil.c @@ -30,31 +30,31 @@ void cleanup_Py_DECREFp(PyObject **p) { } PyObject* absolute_timeout(uint64_t t) { - if (t == (uint64_t) -1) - return PyLong_FromLong(-1); - else { - struct timespec ts; - uint64_t n; - int msec; - - clock_gettime(CLOCK_MONOTONIC, &ts); - n = (uint64_t) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; - msec = t > n ? (int) ((t - n + 999) / 1000) : 0; - - return PyLong_FromLong(msec); - } + if (t == (uint64_t) -1) + return PyLong_FromLong(-1); + else { + struct timespec ts; + uint64_t n; + int msec; + + clock_gettime(CLOCK_MONOTONIC, &ts); + n = (uint64_t) ts.tv_sec * 1000000 + ts.tv_nsec / 1000; + msec = t > n ? (int) ((t - n + 999) / 1000) : 0; + + return PyLong_FromLong(msec); + } } int set_error(int r, const char* path, const char* invalid_message) { - if (r >= 0) - return r; - if (r == -EINVAL && invalid_message) - PyErr_SetString(PyExc_ValueError, invalid_message); - else if (r == -ENOMEM) - PyErr_SetString(PyExc_MemoryError, "Not enough memory"); - else { - errno = -r; - PyErr_SetFromErrnoWithFilename(PyExc_OSError, path); - } - return -1; + if (r >= 0) + return r; + if (r == -EINVAL && invalid_message) + PyErr_SetString(PyExc_ValueError, invalid_message); + else if (r == -ENOMEM) + PyErr_SetString(PyExc_MemoryError, "Not enough memory"); + else { + errno = -r; + PyErr_SetFromErrnoWithFilename(PyExc_OSError, path); + } + return -1; } |