From: Panu Matilainen Date: Tue, 22 Sep 2009 21:06:13 +0000 (+0300) Subject: Add type checking macros for all rpm python type objects X-Git-Tag: rpm-4.8.0-beta1~217 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2a8da8606fc169aa9929e9a1550c8e29c466880b;p=platform%2Fupstream%2Frpm.git Add type checking macros for all rpm python type objects --- diff --git a/python/header-py.h b/python/header-py.h index 2eb6229..51f176b 100644 --- a/python/header-py.h +++ b/python/header-py.h @@ -7,6 +7,8 @@ typedef struct hdrObject_s hdrObject; extern PyTypeObject hdr_Type; +#define hdrObject_Check(v) ((v)->ob_type == &hdr_Type) + extern PyObject * pyrpmError; PyObject * hdr_Wrap(Header h); diff --git a/python/rpmds-py.h b/python/rpmds-py.h index 8fb8375..a00eb7d 100644 --- a/python/rpmds-py.h +++ b/python/rpmds-py.h @@ -7,6 +7,8 @@ typedef struct rpmdsObject_s rpmdsObject; extern PyTypeObject rpmds_Type; +#define rpmdsObject_Check(v) ((v)->ob_type == &rpmds_Type) + rpmds dsFromDs(rpmdsObject * ds); PyObject * rpmds_Wrap(rpmds ds); diff --git a/python/rpmfi-py.h b/python/rpmfi-py.h index 6147d6d..faa292b 100644 --- a/python/rpmfi-py.h +++ b/python/rpmfi-py.h @@ -7,6 +7,8 @@ typedef struct rpmfiObject_s rpmfiObject; extern PyTypeObject rpmfi_Type; +#define rpmfiObject_Check(v) ((v)->ob_type == &rpmfi_Type) + rpmfi fiFromFi(rpmfiObject * fi); PyObject * rpmfi_Wrap(rpmfi fi); diff --git a/python/rpmmi-py.h b/python/rpmmi-py.h index b832c2d..e5410d6 100644 --- a/python/rpmmi-py.h +++ b/python/rpmmi-py.h @@ -5,6 +5,8 @@ typedef struct rpmmiObject_s rpmmiObject; extern PyTypeObject rpmmi_Type; +#define rpmmiObject_Check(v) ((v)->ob_type == &rpmmi_Type) + PyObject * rpmmi_Wrap(rpmdbMatchIterator mi, PyObject *s); #endif diff --git a/python/rpmps-py.h b/python/rpmps-py.h index 350bccd..de7af09 100644 --- a/python/rpmps-py.h +++ b/python/rpmps-py.h @@ -7,6 +7,8 @@ typedef struct rpmpsObject_s rpmpsObject; extern PyTypeObject rpmps_Type; +#define rpmpsObject_Check(v) ((v)->ob_type == &rpmps_Type) + rpmps psFromPs(rpmpsObject * ps); PyObject * rpmps_Wrap(rpmps ps); diff --git a/python/rpmte-py.h b/python/rpmte-py.h index e6bfda9..0a273ed 100644 --- a/python/rpmte-py.h +++ b/python/rpmte-py.h @@ -7,6 +7,8 @@ typedef struct rpmteObject_s rpmteObject; extern PyTypeObject rpmte_Type; +#define rpmteObject_Check(v) ((v)->ob_type == &rpmte_Type) + PyObject * rpmte_Wrap(rpmte te); #endif diff --git a/python/rpmts-py.h b/python/rpmts-py.h index cad663e..956a11b 100644 --- a/python/rpmts-py.h +++ b/python/rpmts-py.h @@ -7,6 +7,8 @@ typedef struct rpmtsObject_s rpmtsObject; extern PyTypeObject rpmts_Type; +#define rpmtsObject_Check(v) ((v)->ob_type == &rpmts_Type) + /* XXX These names/constants have been removed from the rpmlib API. */ enum { RPMDEP_SENSE_REQUIRES, /*!< requirement not satisfied. */ diff --git a/python/spec-py.h b/python/spec-py.h index 0ed16e6..25eac76 100644 --- a/python/spec-py.h +++ b/python/spec-py.h @@ -7,6 +7,8 @@ typedef struct specObject_s specObject; extern PyTypeObject spec_Type; +#define specObject_Check(v) ((v)->ob_type == &spec_Type) + rpmSpec specFromSpec(specObject * spec); PyObject * spec_Wrap(rpmSpec spec);