Mercurial > pidgin
view finch/libgnt/pygnt/common.c @ 19582:d4fb44035799
merge of '1bc4d7f1a38917e6d2bf837a660f5f498a29ea0c'
and 'dd0060c3e748fd6d877ca32879c785c9bdb434fc'
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Mon, 03 Sep 2007 02:19:23 +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; }