Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4d32df

Browse files
committed
Remove function definition from cStringIO.h.
xxxPyCObject_Import() seems to be a copy of PyCObject_Import().
1 parent 5f8a23f commit f4d32df

1 file changed

Lines changed: 4 additions & 23 deletions

File tree

Include/cStringIO.h

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ extern "C" {
1818
This would typically be done in your init function.
1919
2020
*/
21+
#define PycString_IMPORT \
22+
PycStringIO = (struct PycStringIO_CAPI*)PyCObject_Import("cStringIO", \
23+
"cStringIO_CAPI")
2124

2225
/* Basic functions to manipulate cStringIO objects from C */
2326

@@ -46,36 +49,14 @@ static struct PycStringIO_CAPI {
4649
*/
4750
PyTypeObject *InputType, *OutputType;
4851

49-
} * PycStringIO = NULL;
52+
} *PycStringIO;
5053

5154
/* These can be used to test if you have one */
5255
#define PycStringIO_InputCheck(O) \
5356
((O)->ob_type==PycStringIO->InputType)
5457
#define PycStringIO_OutputCheck(O) \
5558
((O)->ob_type==PycStringIO->OutputType)
5659

57-
static void *
58-
xxxPyCObject_Import(char *module_name, char *name)
59-
{
60-
PyObject *m, *c;
61-
void *r=NULL;
62-
63-
if((m=PyImport_ImportModule(module_name)))
64-
{
65-
if((c=PyObject_GetAttrString(m,name)))
66-
{
67-
r=PyCObject_AsVoidPtr(c);
68-
Py_DECREF(c);
69-
}
70-
Py_DECREF(m);
71-
}
72-
73-
return r;
74-
}
75-
76-
#define PycString_IMPORT \
77-
PycStringIO=(struct PycStringIO_CAPI*)xxxPyCObject_Import("cStringIO", "cStringIO_CAPI")
78-
7960
#ifdef __cplusplus
8061
}
8162
#endif

0 commit comments

Comments
 (0)