File: hiredis.h

package info (click to toggle)
python-hiredis 0.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 408 kB
  • sloc: ansic: 4,214; python: 271; makefile: 10
file content (42 lines) | stat: -rw-r--r-- 899 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef __HIREDIS_PY_H
#define __HIREDIS_PY_H

#include <Python.h>
#include <hiredis/read.h>

#ifndef PyMODINIT_FUNC	/* declarations for DLL import/export */
#define PyMODINIT_FUNC void
#endif

#if PY_MAJOR_VERSION >= 3
#define IS_PY3K 1
#endif

#ifndef MOD_HIREDIS
#define MOD_HIREDIS "hiredis"
#endif

struct hiredis_ModuleState {
    PyObject *HiErr_Base;
    PyObject *HiErr_ProtocolError;
    PyObject *HiErr_ReplyError;
};

#if IS_PY3K
#define GET_STATE(__s) ((struct hiredis_ModuleState*)PyModule_GetState(__s))
#else
extern struct hiredis_ModuleState hiredis_py_module_state;
#define GET_STATE(__s) (&hiredis_py_module_state)
#endif

/* Keep pointer around for other classes to access the module state. */
extern PyObject *mod_hiredis;
#define HIREDIS_STATE (GET_STATE(mod_hiredis))

#ifdef IS_PY3K
PyMODINIT_FUNC PyInit_hiredis(void);
#else
PyMODINIT_FUNC inithiredis(void);
#endif

#endif