Esempio n. 1
0
PyObject *
advisorylist_to_pylist(const HyAdvisoryList advisorylist, PyObject *sack)
{
    HyAdvisory cadvisory;
    PyObject *advisory;

    PyObject *list = PyList_New(0);
    if (list == NULL)
	return NULL;

    const int count = hy_advisorylist_count(advisorylist);
    for (int i = 0; i < count; ++i) {
	cadvisory = hy_advisorylist_get_clone(advisorylist,  i);
	advisory = advisoryToPyObject(cadvisory, sack);

	if (advisory == NULL)
	    goto fail;

	int rc = PyList_Append(list, advisory);
	Py_DECREF(advisory);
	if (rc == -1)
	    goto fail;
    }

    return list;
 fail:
    Py_DECREF(list);
    return NULL;
}
Esempio n. 2
0
PyObject *
advisorylist_to_pylist(const GPtrArray *advisorylist, PyObject *sack)
{
    DnfAdvisory *cadvisory;
    PyObject *advisory;

    PyObject *list = PyList_New(0);
    if (list == NULL)
        return NULL;

    for (unsigned int i = 0; i < advisorylist->len; ++i) {
        cadvisory = g_object_ref(g_ptr_array_index(advisorylist, i));
        advisory = advisoryToPyObject(cadvisory, sack);

        if (advisory == NULL)
            goto fail;

        int rc = PyList_Append(list, advisory);
        Py_DECREF(advisory);
        if (rc == -1)
            goto fail;
    }

    return list;
 fail:
    Py_DECREF(list);
    return NULL;
}