[pygobject/gsoc2009: 105/160] Refactor _wrap_g_irepository_find_by_name
- From: Simon van der Linden <svdlinden src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pygobject/gsoc2009: 105/160] Refactor _wrap_g_irepository_find_by_name
- Date: Fri, 14 Aug 2009 21:32:34 +0000 (UTC)
commit e656a99cbb6a6875ae99cb9d2d0ae2b731ab3b46
Author: Simon van der Linden <svdlinden src gnome org>
Date: Mon Aug 3 23:10:30 2009 +0200
Refactor _wrap_g_irepository_find_by_name
gi/pygirepository.c | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/gi/pygirepository.c b/gi/pygirepository.c
index dd0ae82..da71640 100644
--- a/gi/pygirepository.c
+++ b/gi/pygirepository.c
@@ -110,26 +110,30 @@ _wrap_g_irepository_require(PyGIRepository *self, PyObject *args, PyObject *kwar
}
static PyObject *
-_wrap_g_irepository_find_by_name(PyGIRepository *self,
- PyObject *args,
- PyObject *kwargs)
+_wrap_g_irepository_find_by_name(PyGIRepository *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "namespace", "name", NULL };
- char *namespace, *name;
+
+ const char *namespace_;
+ const char *name;
GIBaseInfo *info;
+ PyObject *py_info;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "ss:Repository.find_by_name",
- kwlist, &namespace, &name))
+ "ss:Repository.find_by_name", kwlist, &namespace_, &name)) {
return NULL;
+ }
- info = g_irepository_find_by_name (self->repository, namespace, name);
- if (!info) {
- Py_INCREF(Py_None);
- return Py_None;
+ info = g_irepository_find_by_name(self->repository, namespace_, name);
+ if (info == NULL) {
+ Py_RETURN_NONE;
}
- return pyg_info_new(info);
+ py_info = pyg_info_new(info);
+
+ g_base_info_unref(info);
+
+ return py_info;
}
static PyObject *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]