Mercurial > pidgin.yaz
view finch/libgnt/pygnt/common.c @ 19296:2ec9d975a37d
merge of '2a491439465c5e397575898b7acc45446c9e2eeb'
and '8c7ff33a8a8e1839194829073ff671638fd0b1be'
author | Richard Nelson <wabz@pidgin.im> |
---|---|
date | Fri, 17 Aug 2007 00:35:12 +0000 |
parents | 5e1412f4e67a |
children |
line wrap: on
line source
#include "common.h" PyObject * create_pyobject_from_string_list(GList *list) { PyObject *py_list; if (list == NULL) { Py_INCREF(Py_None); return Py_None; } if ((py_list = PyList_New(0)) == NULL) { g_list_foreach(list, (GFunc)g_free, NULL); g_list_free(list); return NULL; } while (list) { PyObject *obj = PyString_FromString(list->data); PyList_Append(py_list, obj); Py_DECREF(obj); g_free(list->data); list = g_list_delete_link(list, list); } return py_list; }