Commit a1dc8203 authored by Stefan Behnel's avatar Stefan Behnel

minor code simplifications and fixes in printing utility code

parent 00ff6bdd
...@@ -28,7 +28,6 @@ static PyObject *__Pyx_GetStdout(void) { ...@@ -28,7 +28,6 @@ static PyObject *__Pyx_GetStdout(void) {
} }
static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
PyObject* v;
int i; int i;
if (!f) { if (!f) {
...@@ -37,6 +36,7 @@ static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { ...@@ -37,6 +36,7 @@ static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
} }
Py_INCREF(f); Py_INCREF(f);
for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
PyObject* v;
if (PyFile_SoftSpace(f, 1)) { if (PyFile_SoftSpace(f, 1)) {
if (PyFile_WriteString(" ", f) < 0) if (PyFile_WriteString(" ", f) < 0)
goto error; goto error;
...@@ -150,8 +150,8 @@ static int __Pyx_PrintOne(PyObject* f, PyObject *o) { ...@@ -150,8 +150,8 @@ static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
error: error:
Py_DECREF(f); Py_DECREF(f);
return -1; return -1;
/* the line below is just to avoid compiler /* the line below is just to avoid C compiler
* compiler warnings about unused functions */ * warnings about unused functions */
return __Pyx_Print(f, NULL, 0); return __Pyx_Print(f, NULL, 0);
} }
...@@ -159,11 +159,9 @@ error: ...@@ -159,11 +159,9 @@ error:
static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
int res; int res;
PyObject* arg_tuple = PyTuple_New(1); PyObject* arg_tuple = PyTuple_Pack(1, o);
if (unlikely(!arg_tuple)) if (unlikely(!arg_tuple))
return -1; return -1;
Py_INCREF(o);
PyTuple_SET_ITEM(arg_tuple, 0, o);
res = __Pyx_Print(stream, arg_tuple, 1); res = __Pyx_Print(stream, arg_tuple, 1);
Py_DECREF(arg_tuple); Py_DECREF(arg_tuple);
return res; return res;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment