| Line | |
|---|
| 1 | /* |
|---|
| 2 | * Copyright: 2006 Brian Harring <ferringb@gmail.com> |
|---|
| 3 | * Copyright: 2006 Marien Zwart <marienz@gentoo.org> |
|---|
| 4 | * License: GPL2 |
|---|
| 5 | * |
|---|
| 6 | * C version of some of pkgcore (for extra speed). |
|---|
| 7 | */ |
|---|
| 8 | |
|---|
| 9 | /* This does not really do anything since we do not use the "#" |
|---|
| 10 | * specifier in a PyArg_Parse or similar call, but hey, not using it |
|---|
| 11 | * means we are Py_ssize_t-clean too! |
|---|
| 12 | */ |
|---|
| 13 | |
|---|
| 14 | #ifndef PKGCORE_COMMON_INCLUDE |
|---|
| 15 | #define PKGCORE_COMMON_INCLUDE 1 |
|---|
| 16 | |
|---|
| 17 | /* Compatibility with python < 2.5 */ |
|---|
| 18 | |
|---|
| 19 | #if PY_VERSION_HEX < 0x02050000 |
|---|
| 20 | typedef int Py_ssize_t; |
|---|
| 21 | #define PY_SSIZE_T_MAX INT_MAX |
|---|
| 22 | #define PY_SSIZE_T_MIN INT_MIN |
|---|
| 23 | typedef Py_ssize_t (*lenfunc)(PyObject *); |
|---|
| 24 | #endif |
|---|
| 25 | |
|---|
| 26 | /* From heapy */ |
|---|
| 27 | #include "heapdef.h" |
|---|
| 28 | |
|---|
| 29 | /* Copied from stdtypes.c in guppy */ |
|---|
| 30 | #define INTERATTR(name) \ |
|---|
| 31 | if ((PyObject *)v->name == r->tgt && \ |
|---|
| 32 | (r->visit(NYHR_INTERATTR, PyString_FromString(#name), r))) \ |
|---|
| 33 | return 1; |
|---|
| 34 | |
|---|
| 35 | #endif |
|---|