From ae1fd3fa479bfafcc65b9ea532cafb401ed9a031 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 22 Sep 2009 16:47:07 +0300 Subject: Make the python object structures opaque --- python/rpmdb-py.c | 11 +++++++++++ python/rpmdb-py.h | 11 ----------- python/rpmds-py.c | 9 +++++++++ python/rpmds-py.h | 9 +-------- python/rpmfi-py.c | 6 ++++++ python/rpmfi-py.h | 7 +------ python/rpmmi-py.c | 9 +++++++++ python/rpmmi-py.h | 9 --------- python/rpmps-py.c | 8 ++++++++ python/rpmps-py.h | 9 +-------- python/rpmte-py.c | 6 ++++++ python/rpmte-py.h | 6 +----- python/rpmts-py.c | 11 +++++++++++ python/rpmts-py.h | 11 +---------- python/spec-py.c | 5 +++++ python/spec-py.h | 6 +----- 16 files changed, 71 insertions(+), 62 deletions(-) diff --git a/python/rpmdb-py.c b/python/rpmdb-py.c index c6778526e..92203b0ef 100644 --- a/python/rpmdb-py.c +++ b/python/rpmdb-py.c @@ -101,6 +101,17 @@ * \name Class: rpm.db */ +/** \ingroup py_c + */ +struct rpmdbObject_s { + PyObject_HEAD + PyObject *md_dict; /*!< to look like PyModuleObject */ + rpmdb db; + int offx; + int noffs; + int *offsets; +} ; + /** */ static rpmmiObject * diff --git a/python/rpmdb-py.h b/python/rpmdb-py.h index 843ca008e..c92d74a52 100644 --- a/python/rpmdb-py.h +++ b/python/rpmdb-py.h @@ -11,17 +11,6 @@ */ typedef struct rpmdbObject_s rpmdbObject; -/** \ingroup py_c - */ -struct rpmdbObject_s { - PyObject_HEAD - PyObject *md_dict; /*!< to look like PyModuleObject */ - rpmdb db; - int offx; - int noffs; - int *offsets; -} ; - extern PyTypeObject rpmdb_Type; #endif diff --git a/python/rpmds-py.c b/python/rpmds-py.c index 7dd5a0be6..91e66efa9 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -13,6 +13,15 @@ #include "debug.h" +/** + */ +struct rpmdsObject_s { + PyObject_HEAD + PyObject *md_dict; /*!< to look like PyModuleObject */ + int active; + rpmds ds; +}; + /** * Split EVR into epoch, version, and release components. diff --git a/python/rpmds-py.h b/python/rpmds-py.h index c029e97dc..d208de909 100644 --- a/python/rpmds-py.h +++ b/python/rpmds-py.h @@ -7,14 +7,7 @@ * \file python/rpmds-py.h */ -/** - */ -typedef struct rpmdsObject_s { - PyObject_HEAD - PyObject *md_dict; /*!< to look like PyModuleObject */ - int active; - rpmds ds; -} rpmdsObject; +typedef struct rpmdsObject_s rpmdsObject; /** */ diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c index d3a18751e..9e318c053 100644 --- a/python/rpmfi-py.c +++ b/python/rpmfi-py.c @@ -12,6 +12,12 @@ #include "debug.h" +struct rpmfiObject_s { + PyObject_HEAD + PyObject *md_dict; /*!< to look like PyModuleObject */ + int active; + rpmfi fi; +}; static PyObject * rpmfi_Debug(rpmfiObject * s, PyObject * args, PyObject * kwds) diff --git a/python/rpmfi-py.h b/python/rpmfi-py.h index cb7575009..37315a9bd 100644 --- a/python/rpmfi-py.h +++ b/python/rpmfi-py.h @@ -7,12 +7,7 @@ * \file python/rpmfi-py.h */ -typedef struct rpmfiObject_s { - PyObject_HEAD - PyObject *md_dict; /*!< to look like PyModuleObject */ - int active; - rpmfi fi; -} rpmfiObject; +typedef struct rpmfiObject_s rpmfiObject; extern PyTypeObject rpmfi_Type; diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c index 1b9907e1a..9ab745732 100644 --- a/python/rpmmi-py.c +++ b/python/rpmmi-py.c @@ -64,6 +64,15 @@ * \name Class: Rpmmi */ +/** \ingroup py_c + */ +struct rpmmiObject_s { + PyObject_HEAD + PyObject *md_dict; /*!< to look like PyModuleObject */ + PyObject *ref; /* for db/ts refcounting */ + rpmdbMatchIterator mi; +} ; + /** */ static PyObject * diff --git a/python/rpmmi-py.h b/python/rpmmi-py.h index 16565bada..d8fe9ff1a 100644 --- a/python/rpmmi-py.h +++ b/python/rpmmi-py.h @@ -9,15 +9,6 @@ */ typedef struct rpmmiObject_s rpmmiObject; -/** \ingroup py_c - */ -struct rpmmiObject_s { - PyObject_HEAD - PyObject *md_dict; /*!< to look like PyModuleObject */ - PyObject *ref; /* for db/ts refcounting */ - rpmdbMatchIterator mi; -} ; - extern PyTypeObject rpmmi_Type; rpmmiObject * rpmmi_Wrap(rpmdbMatchIterator mi, PyObject *s); diff --git a/python/rpmps-py.c b/python/rpmps-py.c index 718a9bb06..f7242c68e 100644 --- a/python/rpmps-py.c +++ b/python/rpmps-py.c @@ -8,6 +8,14 @@ #include "debug.h" +/** + */ +struct rpmpsObject_s { + PyObject_HEAD + PyObject *md_dict; /*!< to look like PyModuleObject */ + rpmps ps; + rpmpsi psi; +}; static PyObject * rpmps_Debug(rpmpsObject * s, PyObject * args, PyObject * kwds) diff --git a/python/rpmps-py.h b/python/rpmps-py.h index 86844f622..de68a2b86 100644 --- a/python/rpmps-py.h +++ b/python/rpmps-py.h @@ -7,14 +7,7 @@ * \file python/rpmps-py.h */ -/** - */ -typedef struct rpmpsObject_s { - PyObject_HEAD - PyObject *md_dict; /*!< to look like PyModuleObject */ - rpmps ps; - rpmpsi psi; -} rpmpsObject; +typedef struct rpmpsObject_s rpmpsObject; /** */ diff --git a/python/rpmte-py.c b/python/rpmte-py.c index 412e54306..688b27342 100644 --- a/python/rpmte-py.c +++ b/python/rpmte-py.c @@ -48,6 +48,12 @@ * @param tag 'Basenames' */ +struct rpmteObject_s { + PyObject_HEAD + PyObject *md_dict; /*!< to look like PyModuleObject */ + rpmte te; +}; + static PyObject * rpmte_Debug(rpmteObject * s, PyObject * args, PyObject * kwds) { diff --git a/python/rpmte-py.h b/python/rpmte-py.h index 103827409..1b2310a5a 100644 --- a/python/rpmte-py.h +++ b/python/rpmte-py.h @@ -7,11 +7,7 @@ * \file python/rpmte-py.h */ -typedef struct rpmteObject_s { - PyObject_HEAD - PyObject *md_dict; /*!< to look like PyModuleObject */ - rpmte te; -} rpmteObject; +typedef struct rpmteObject_s rpmteObject; extern PyTypeObject rpmte_Type; diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 5d7c12c85..169f6744a 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -140,6 +140,17 @@ extern int _rpmts_debug; * the ts.run() method. */ +struct rpmtsObject_s { + PyObject_HEAD + PyObject *md_dict; /*!< to look like PyModuleObject */ + rpmts ts; + PyObject * keyList; /* keeps reference counts correct */ + FD_t scriptFd; + rpmtsi tsi; + rpmElementType tsiFilter; + rpmprobFilterFlags ignoreSet; +}; + /** \ingroup py_c */ struct rpmtsCallbackType_s { diff --git a/python/rpmts-py.h b/python/rpmts-py.h index fbc64e049..212080f04 100644 --- a/python/rpmts-py.h +++ b/python/rpmts-py.h @@ -7,16 +7,7 @@ * \file python/rpmts-py.h */ -typedef struct rpmtsObject_s { - PyObject_HEAD - PyObject *md_dict; /*!< to look like PyModuleObject */ - rpmts ts; - PyObject * keyList; /* keeps reference counts correct */ - FD_t scriptFd; - rpmtsi tsi; - rpmElementType tsiFilter; - rpmprobFilterFlags ignoreSet; -} rpmtsObject; +typedef struct rpmtsObject_s rpmtsObject; extern PyTypeObject rpmts_Type; diff --git a/python/spec-py.c b/python/spec-py.c index 0d17896fc..7054bd22e 100644 --- a/python/spec-py.c +++ b/python/spec-py.c @@ -32,6 +32,11 @@ * */ +struct specObject_s { + PyObject_HEAD + /*type specific fields */ + rpmSpec spec; +}; static void spec_dealloc(specObject * s) diff --git a/python/spec-py.h b/python/spec-py.h index 8004d1efd..7e6a04494 100644 --- a/python/spec-py.h +++ b/python/spec-py.h @@ -7,11 +7,7 @@ * \file python/spec-py.h */ -typedef struct specObject_s { - PyObject_HEAD - /*type specific fields */ - rpmSpec spec; -} specObject; +typedef struct specObject_s specObject; extern PyTypeObject spec_Type; -- cgit v1.2.1