Allow entering a search string to search in some specific field.
[python-gnt.git] / common.c
blob2974a72cef0cf64abf782a309db4ad4e3e6a37d5
1 #include "common.h"
3 PyObject *
4 create_pyobject_from_string_list(GList *list)
6 PyObject *py_list;
7 if (list == NULL) {
8 Py_INCREF(Py_None);
9 return Py_None;
11 if ((py_list = PyList_New(0)) == NULL) {
12 g_list_foreach(list, (GFunc)g_free, NULL);
13 g_list_free(list);
14 return NULL;
16 while (list) {
17 PyObject *obj = PyString_FromString(list->data);
18 PyList_Append(py_list, obj);
19 Py_DECREF(obj);
20 g_free(list->data);
21 list = g_list_delete_link(list, list);
23 return py_list;