Mercurial > pidgin.yaz
view finch/libgnt/pygnt/common.c @ 21904:9b299228431c
merge of '05319fdf1db00660d0c169657ed1b08ff621e5c7'
and 'a654aa0d3c35e43c2f23b266100bfdb4d98e2d73'
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Wed, 19 Dec 2007 11:31:37 +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; }