]>
Commit | Line | Data |
---|---|---|
663996b3 MS |
1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
2 | ||
3 | #pragma once | |
4 | ||
5 | /*** | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2013 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
11 | under the terms of the GNU Lesser General Public License as published by | |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
13 | (at your option) any later version. | |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | Lesser General Public License for more details. | |
19 | ||
20 | You should have received a copy of the GNU Lesser General Public License | |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
22 | ***/ | |
23 | ||
24 | #ifndef Py_TYPE | |
25 | /* avoid duplication warnings from errors in Python 2.7 headers */ | |
26 | # include <Python.h> | |
27 | #endif | |
28 | ||
29 | void cleanup_Py_DECREFp(PyObject **p); | |
30 | PyObject* absolute_timeout(uint64_t t); | |
14228c0d MB |
31 | int set_error(int r, const char* path, const char* invalid_message); |
32 | ||
33 | #if PY_MAJOR_VERSION >=3 && PY_MINOR_VERSION >= 1 | |
34 | int Unicode_FSConverter(PyObject* obj, void *_result); | |
35 | #endif | |
663996b3 MS |
36 | |
37 | #define _cleanup_Py_DECREF_ __attribute__((cleanup(cleanup_Py_DECREFp))) | |
38 | ||
39 | #if PY_MAJOR_VERSION >=3 | |
40 | # define unicode_FromStringAndSize PyUnicode_FromStringAndSize | |
41 | # define unicode_FromString PyUnicode_FromString | |
42 | # define long_FromLong PyLong_FromLong | |
43 | # define long_FromSize_t PyLong_FromSize_t | |
44 | # define long_Check PyLong_Check | |
45 | # define long_AsLong PyLong_AsLong | |
46 | #else | |
47 | /* Python 3 type naming convention is used */ | |
48 | # define unicode_FromStringAndSize PyString_FromStringAndSize | |
49 | # define unicode_FromString PyString_FromString | |
50 | # define long_FromLong PyInt_FromLong | |
51 | # define long_FromSize_t PyInt_FromSize_t | |
52 | # define long_Check PyInt_Check | |
53 | # define long_AsLong PyInt_AsLong | |
54 | #endif |