[gimp/gimp-2-8] Bug 751584 - parasite_list() methods fail if no parasites found
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 751584 - parasite_list() methods fail if no parasites found
- Date: Tue, 15 Sep 2015 07:38:00 +0000 (UTC)
commit f55dd9a7f33a03c918649ff2e14ad517df375b60
Author: Jonathan Tait <jontait2 gmail com>
Date: Tue Sep 15 05:37:37 2015 +0100
Bug 751584 - parasite_list() methods fail if no parasites found
Correct parasite_list() methods.
plug-ins/pygimp/gimpmodule.c | 22 ++++++++--------------
plug-ins/pygimp/pygimp-drawable.c | 22 ++++++++--------------
plug-ins/pygimp/pygimp-image.c | 23 ++++++++---------------
plug-ins/pygimp/pygimp-vectors.c | 22 ++++++++--------------
4 files changed, 32 insertions(+), 57 deletions(-)
---
diff --git a/plug-ins/pygimp/gimpmodule.c b/plug-ins/pygimp/gimpmodule.c
index 560f398..3e4862e 100644
--- a/plug-ins/pygimp/gimpmodule.c
+++ b/plug-ins/pygimp/gimpmodule.c
@@ -1308,26 +1308,20 @@ pygimp_parasite_list(PyObject *self)
{
gint num_parasites;
gchar **parasites;
+ PyObject *ret;
+ gint i;
parasites = gimp_get_parasite_list (&num_parasites);
- if (parasites) {
- PyObject *ret;
- gint i;
-
- ret = PyTuple_New(num_parasites);
-
- for (i = 0; i < num_parasites; i++) {
- PyTuple_SetItem(ret, i, PyString_FromString(parasites[i]));
- g_free(parasites[i]);
- }
+ ret = PyTuple_New(num_parasites);
- g_free(parasites);
- return ret;
+ for (i = 0; i < num_parasites; i++) {
+ PyTuple_SetItem(ret, i, PyString_FromString(parasites[i]));
+ g_free(parasites[i]);
}
- PyErr_SetString(pygimp_error, "could not list parasites");
- return NULL;
+ g_free(parasites);
+ return ret;
}
static PyObject *
diff --git a/plug-ins/pygimp/pygimp-drawable.c b/plug-ins/pygimp/pygimp-drawable.c
index 80c3ba4..ebd20b8 100644
--- a/plug-ins/pygimp/pygimp-drawable.c
+++ b/plug-ins/pygimp/pygimp-drawable.c
@@ -307,26 +307,20 @@ drw_parasite_list(PyGimpDrawable *self)
{
gint num_parasites;
gchar **parasites;
+ PyObject *ret;
+ gint i;
parasites = gimp_item_get_parasite_list(self->ID, &num_parasites);
- if (parasites) {
- PyObject *ret;
- gint i;
-
- ret = PyTuple_New(num_parasites);
- for (i = 0; i < num_parasites; i++) {
- PyTuple_SetItem(ret, i, PyString_FromString(parasites[i]));
- g_free(parasites[i]);
- }
+ ret = PyTuple_New(num_parasites);
- g_free(parasites);
- return ret;
+ for (i = 0; i < num_parasites; i++) {
+ PyTuple_SetItem(ret, i, PyString_FromString(parasites[i]));
+ g_free(parasites[i]);
}
- PyErr_Format(pygimp_error, "could not list parasites on drawable (ID %d)",
- self->ID);
- return NULL;
+ g_free(parasites);
+ return ret;
}
static PyObject *
diff --git a/plug-ins/pygimp/pygimp-image.c b/plug-ins/pygimp/pygimp-image.c
index 7c1926c..d88a38a 100644
--- a/plug-ins/pygimp/pygimp-image.c
+++ b/plug-ins/pygimp/pygimp-image.c
@@ -725,27 +725,20 @@ img_parasite_list(PyGimpImage *self)
{
gint num_parasites;
gchar **parasites;
+ PyObject *ret;
+ gint i;
parasites = gimp_image_get_parasite_list (self->ID, &num_parasites);
- if (parasites) {
- PyObject *ret;
- gint i;
-
- ret = PyTuple_New(num_parasites);
-
- for (i = 0; i < num_parasites; i++) {
- PyTuple_SetItem(ret, i, PyString_FromString(parasites[i]));
- g_free(parasites[i]);
- }
+ ret = PyTuple_New(num_parasites);
- g_free(parasites);
- return ret;
+ for (i = 0; i < num_parasites; i++) {
+ PyTuple_SetItem(ret, i, PyString_FromString(parasites[i]));
+ g_free(parasites[i]);
}
- PyErr_Format(pygimp_error, "could not list parasites on image (ID %d)",
- self->ID);
- return NULL;
+ g_free(parasites);
+ return ret;
}
static PyObject *
diff --git a/plug-ins/pygimp/pygimp-vectors.c b/plug-ins/pygimp/pygimp-vectors.c
index fa83ab6..f7b5f3c 100644
--- a/plug-ins/pygimp/pygimp-vectors.c
+++ b/plug-ins/pygimp/pygimp-vectors.c
@@ -697,26 +697,20 @@ vectors_parasite_list(PyGimpVectors *self)
{
gint num_parasites;
gchar **parasites;
+ PyObject *ret;
+ gint i;
parasites = gimp_item_get_parasite_list(self->ID, &num_parasites);
- if (parasites) {
- PyObject *ret;
- gint i;
-
- ret = PyTuple_New(num_parasites);
- for (i = 0; i < num_parasites; i++) {
- PyTuple_SetItem(ret, i, PyString_FromString(parasites[i]));
- g_free(parasites[i]);
- }
+ ret = PyTuple_New(num_parasites);
- g_free(parasites);
- return ret;
+ for (i = 0; i < num_parasites; i++) {
+ PyTuple_SetItem(ret, i, PyString_FromString(parasites[i]));
+ g_free(parasites[i]);
}
- PyErr_Format(pygimp_error, "could not list parasites on vectors (ID %d)",
- self->ID);
- return NULL;
+ g_free(parasites);
+ return ret;
}
static PyMethodDef vectors_methods[] = {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]