summaryrefslogtreecommitdiff
path: root/python/rpmfd-py.h
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-10-15 10:11:37 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-10-15 10:11:37 +0300
commit410bf68fd41a6b8c98e48ca77e093f2f6c6bda75 (patch)
treeec820040f66bd1d053ed57a726b2901a3421a66a /python/rpmfd-py.h
parent50ad087c1030be242ab658c818ba2990dd33855e (diff)
downloadlibrpm-tizen-410bf68fd41a6b8c98e48ca77e093f2f6c6bda75.tar.gz
librpm-tizen-410bf68fd41a6b8c98e48ca77e093f2f6c6bda75.tar.bz2
librpm-tizen-410bf68fd41a6b8c98e48ca77e093f2f6c6bda75.zip
Accept rpm.fd() types file objects everywhere in python bindings
- turn rpmfdFromPyObject() into a python-level object converter, add a separate C-level getter for the fd pointer itself - take advantage of python refcounting to handle differences between native vs converted rpm.fd in callers so we can simply decref the rpmfdFromPyObject() result without having to worry whether it was converted or not (ie should we close it or not)
Diffstat (limited to 'python/rpmfd-py.h')
-rw-r--r--python/rpmfd-py.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/python/rpmfd-py.h b/python/rpmfd-py.h
index 3e2a9ca87..b84e17444 100644
--- a/python/rpmfd-py.h
+++ b/python/rpmfd-py.h
@@ -7,7 +7,11 @@ typedef struct rpmfdObject_s rpmfdObject;
extern PyTypeObject rpmfd_Type;
-int rpmFdFromPyObject(PyObject *obj, FD_t *fdp);
+#define rpmfdObject_Check(v) ((v)->ob_type == &rpmfd_Type)
+
+FD_t rpmfdGetFd(rpmfdObject *fdo);
+
+int rpmfdFromPyObject(PyObject *obj, rpmfdObject **fdop);
#endif