convert_tuple_to_char_pointer_array(PyObject *argv) {
int argc;
int i, j;
+ char **result;
/* not a list or tuple */
if (!PyList_Check(argv) && !PyTuple_Check(argv)) {
argc = PySequence_Fast_GET_SIZE(argv);
- char **result = (char**) calloc(argc + 1, sizeof(char*));
+ result = (char**) calloc(argc + 1, sizeof(char*));
if (result == NULL) {
PyErr_SetNone(PyExc_MemoryError);
}
for (i = 0; i < argc; i++) {
- PyObject *pyobj = PySequence_Fast_GET_ITEM(argv, i);
- assert(pyobj != NULL);
-
char *str = NULL;
PyObject *pystr = NULL;
+ PyObject *pyobj = PySequence_Fast_GET_ITEM(argv, i);
+ assert(pyobj != NULL);
if (!PyUnicode_Check(pyobj)) {
PyErr_SetString(PyExc_ValueError, "Expected a string");
static char *kwlist[] = {"key", NULL};
char* key = NULL;
int len = 0;
+ char* value;
PyObject *ret = NULL;
if (! PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist,
return NULL;
}
- char* value = (char*) malloc(sizeof(char)*len + 1);
+ value = (char*) malloc(sizeof(char)*len + 1);
if (value == NULL)
return PyErr_NoMemory();
static char *kwlist[] = {"key", NULL};
char* key = NULL;
int len = 0;
+ char* value;
PyObject *ret = NULL;
if (! PyArg_ParseTupleAndKeywords(args, kwds, "s|", kwlist,
return PyUnicode_FromString("");
}
- char* value = (char*) malloc(sizeof(char)*len + 1);
+ value = (char*) malloc(sizeof(char)*len + 1);
if (value == NULL)
return PyErr_NoMemory();
static char *kwlist[] = {"key", NULL};
char* key = NULL;
int len = 0;
+ char* value;
PyObject *ret = NULL;
if (! PyArg_ParseTupleAndKeywords(args, kwds, "|s", kwlist,
return NULL;
}
- char* value = (char*) malloc(sizeof(char)*len + 1);
+ value = (char*) malloc(sizeof(char)*len + 1);
if (value == NULL)
return PyErr_NoMemory();