Mercurial > pidgin
view finch/libgnt/pygnt/common.c @ 18713:8000beb73585
propagate from branch 'im.pidgin.pidgin' (head c2cc31f23a71f23062555721f8101fc9c997bae2)
to branch 'libgnt.pygnt' (head e69d5919b7bf3b9ace0cb482c147654e60e135a8)
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 29 Jul 2007 07:59:10 +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; }