diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/.lclintrc | 127 | ||||
-rw-r--r-- | python/Makefile.am | 10 | ||||
-rw-r--r-- | python/hash.c | 7 | ||||
-rw-r--r-- | python/header-py.c | 28 | ||||
-rw-r--r-- | python/header-py.h | 47 | ||||
-rw-r--r-- | python/rpmal-py.c | 26 | ||||
-rw-r--r-- | python/rpmal-py.h | 4 | ||||
-rw-r--r-- | python/rpmdb-py.c | 26 | ||||
-rw-r--r-- | python/rpmdb-py.h | 13 | ||||
-rw-r--r-- | python/rpmds-py.c | 43 | ||||
-rw-r--r-- | python/rpmds-py.h | 16 | ||||
-rw-r--r-- | python/rpmfd-py.c | 23 | ||||
-rw-r--r-- | python/rpmfd-py.h | 4 | ||||
-rw-r--r-- | python/rpmfi-py.c | 55 | ||||
-rw-r--r-- | python/rpmfi-py.h | 10 | ||||
-rw-r--r-- | python/rpmmi-py.c | 20 | ||||
-rw-r--r-- | python/rpmmi-py.h | 7 | ||||
-rw-r--r-- | python/rpmmodule.c | 5 | ||||
-rw-r--r-- | python/rpmrc-py.c | 50 | ||||
-rw-r--r-- | python/rpmrc-py.h | 12 | ||||
-rw-r--r-- | python/rpmte-py.c | 94 | ||||
-rw-r--r-- | python/rpmte-py.h | 4 | ||||
-rw-r--r-- | python/rpmts-py.c | 99 | ||||
-rw-r--r-- | python/rpmts-py.h | 4 | ||||
-rw-r--r-- | python/upgrade.c | 18 |
25 files changed, 635 insertions, 117 deletions
diff --git a/python/.lclintrc b/python/.lclintrc index cc7d9acbe..70d9da5ae 100644 --- a/python/.lclintrc +++ b/python/.lclintrc @@ -1,36 +1,107 @@ --I. -I.. -I../lib -I../rpmdb -I../rpmio -I../popt -DHAVE_CONFIG_H -D_GNU_SOURCE +-I. -I.. -I../build -I../lib -I../rpmdb -I../rpmio -I../beecrypt -I../popt -DHAVE_CONFIG_H -D_GNU_SOURCE +partial ++forcehints -warnunixlib -warnposix +unixlib -# XXX ignore doxygen markings --unrecogcomments - -# don't-bother-me-yet parameters --branchstate # ~39 --mustfree # ~325 - -# not-yet normal parameters --boolops # ~351 w->n --predboolint # ~200 w->n --type # ~271 - -# -weak paramaters -#+boolint -#-boolops -#+ignorequals -#+ignoresigns -#-mustfree -#+longintegral -#+matchanyintegral -#-nullpass -#-observertrans -#-predboolint -#-predboolothers -#-retvalint -#-retvalother -#-shiftsigned +-unrecogcomments # XXX ignore doxygen markings + ++strict # lclint level + +# --- in progress +#+bounds ++slovak-fcns +-bufferoverflowhigh + +-branchstate +-castfcnptr +-compdef +-evalorderuncon +-exportheader +-globs +-globstate +-incondefs # 1 +-internalglobs +-modfilesys +-modnomods +-modobserveruncon +-moduncon +-modunconnomods +-noeffect +-noeffectuncon +-nullderef +-nullpass +-nullret +-nullstate +-predboolothers +-protoparammatch +-redecl +-redef +-retalias +-retvalint +-retvalother +-sizeoftype +-type +-usereleased + +-dependenttrans +-exposetrans +-immediatetrans +-kepttrans +-newreftrans +-observertrans +-onlytrans +-readonlytrans +-refcounttrans +-statictrans +-temptrans + +-ifempty + +# --- +partial artifacts +-declundef +-exportheadervar +-exportlocal + +-enummemuse +-fcnuse +-typeuse +-varuse + +# --- not-yet at strict level +-bitwisesigned # 160 +-elseifcomplete # 9 +-exportconst # 687 +-exportfcn # 464 +-exporttype # 196 +-exportvar # 55 +-fielduse # 225 occurence <bits/sigset.h> +-forblock # tedious +-ifblock # tedious +-namechecks # 1679 +-ptrarith # 201 + +-compdestroy # 125 +-mustdefine # 76 +-sys-dir-errors + +-strictops # 54 +-strictusereleased # 3 +-whileblock # 20 + +# --- not-yet at checks level ++enumint # 211 +-mustfree # 219 +-predboolptr # 107 +-usedef # 42 + +# --- not-yet at standard level +-boolops # 81 ++boolint # 18 ++charint # 74 ++ignorequals # 104 ++matchanyintegral # 90 diff --git a/python/Makefile.am b/python/Makefile.am index 4a1741f62..ac12b90c6 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -61,6 +61,14 @@ _rpmdb.so$(EXEEXT): $(_rpmdb_so_OBJECTS) poptmodule.so$(EXEEXT): $(poptmodule_so_OBJECTS) $(CC) -o $@ $(poptmodule_so_OBJECTS) $(poptmodule_so_LDFLAGS) +# rpmmodule.c hash.c upgrade.c header-py.c \ +# rpmal-py.c rpmds-py.c rpmdb-py.c rpmfd-py.c rpmfi-py.c rpmmi-py.c \ +# rpmrc-py.c rpmte-py.c rpmts-py.c +# rpmmodule.c header-py.c +splint_srcs = hash.c upgrade.c \ + rpmal-py.c rpmds-py.c rpmdb-py.c rpmfd-py.c rpmfi-py.c rpmmi-py.c \ + rpmrc-py.c rpmte-py.c rpmts-py.c + .PHONY: lclint lclint: - lclint $(DEFS) $(INCLUDES) $(librpmmodule_la_SOURCES) + lclint $(DEFS) $(INCLUDES) $(splint_srcs) diff --git a/python/hash.c b/python/hash.c index 00d734879..f3b88c4b0 100644 --- a/python/hash.c +++ b/python/hash.c @@ -2,13 +2,12 @@ * \file python/hash.c */ -#include <stdlib.h> -#include <unistd.h> -#include <stdio.h> -#include <string.h> +#include "system.h" #include "hash.h" +#include "debug.h" + #define CHUNK 1 struct filePath { diff --git a/python/header-py.c b/python/header-py.c index a875c5391..b3d88e624 100644 --- a/python/header-py.c +++ b/python/header-py.c @@ -5,6 +5,11 @@ #include "system.h" #include "Python.h" +#ifdef __LCLINT__ +#undef PyObject_HEAD +#define PyObject_HEAD int _PyObjectHead; +#endif + #include "rpmio_internal.h" #include "rpmcli.h" /* XXX for rpmCheckSig */ @@ -92,7 +97,9 @@ struct hdrObject_s { unsigned short * modes; } ; -/*@unused@*/ static inline Header headerAllocated(Header h) { +/*@unused@*/ static inline Header headerAllocated(Header h) + /*@modifies h @*/ +{ h->flags |= HEADERFLAG_ALLOCATED; return 0; } @@ -100,6 +107,7 @@ struct hdrObject_s { /** \ingroup python */ static PyObject * hdrKeyList(hdrObject * s, PyObject * args) + /*@*/ { PyObject * list, *o; HeaderIterator hi; @@ -132,7 +140,9 @@ static PyObject * hdrKeyList(hdrObject * s, PyObject * args) /** \ingroup python */ -static PyObject * hdrUnload(hdrObject * s, PyObject * args, PyObject *keywords) { +static PyObject * hdrUnload(hdrObject * s, PyObject * args, PyObject *keywords) + /*@*/ +{ char * buf; PyObject * rc; int len, legacy = 0; @@ -169,6 +179,7 @@ static PyObject * hdrUnload(hdrObject * s, PyObject * args, PyObject *keywords) * It should be passed the file number to verify. */ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) + /*@*/ { int fileNumber; rpmVerifyAttrs verifyResult = 0; @@ -393,6 +404,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) /** \ingroup python */ static PyObject * hdrExpandFilelist(hdrObject * s, PyObject * args) + /*@*/ { expandFilelist (s->h); @@ -403,6 +415,7 @@ static PyObject * hdrExpandFilelist(hdrObject * s, PyObject * args) /** \ingroup python */ static PyObject * hdrCompressFilelist(hdrObject * s, PyObject * args) + /*@*/ { compressFilelist (s->h); @@ -414,6 +427,7 @@ static PyObject * hdrCompressFilelist(hdrObject * s, PyObject * args) /** \ingroup python */ static void mungeFilelist(Header h) + /*@*/ { const char ** fileNames = NULL; int count = 0; @@ -438,6 +452,7 @@ static void mungeFilelist(Header h) /** */ static PyObject * rhnUnload(hdrObject * s, PyObject * args) + /*@*/ { int len; char * uh; @@ -499,6 +514,7 @@ static PyObject * rhnUnload(hdrObject * s, PyObject * args) /** \ingroup python */ static PyObject * hdrFullFilelist(hdrObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, "")) return NULL; @@ -512,6 +528,7 @@ static PyObject * hdrFullFilelist(hdrObject * s, PyObject * args) /** \ingroup python */ static PyObject * hdrSprintf(hdrObject * s, PyObject * args) + /*@*/ { char * fmt; char * r; @@ -536,12 +553,14 @@ static PyObject * hdrSprintf(hdrObject * s, PyObject * args) /** */ static int hdr_compare(hdrObject * a, hdrObject * b) + /*@*/ { return rpmVersionCompare(a->h, b->h); } /** \ingroup python */ +/*@unchecked@*/ /*@observer@*/ static struct PyMethodDef hdr_methods[] = { {"keys", (PyCFunction) hdrKeyList, METH_VARARGS, NULL }, @@ -573,6 +592,7 @@ static struct PyMethodDef hdr_methods[] = { /** \ingroup python */ static PyObject * hdr_getattr(hdrObject * s, char * name) + /*@*/ { return Py_FindMethod(hdr_methods, (PyObject * ) s, name); } @@ -580,6 +600,7 @@ static PyObject * hdr_getattr(hdrObject * s, char * name) /** \ingroup python */ static void hdr_dealloc(hdrObject * s) + /*@*/ { if (s->h) headerFree(s->h); s->md5list = _free(s->md5list); @@ -609,6 +630,7 @@ long tagNumFromPyObject (PyObject *item) /** \ingroup python */ static PyObject * hdr_subscript(hdrObject * s, PyObject * item) + /*@*/ { int type, count, i, tag = -1; void * data; @@ -766,6 +788,7 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item) /** \ingroup python */ +/*@unchecked@*/ /*@observer@*/ static PyMappingMethods hdr_as_mapping = { (inquiry) 0, /* mp_length */ (binaryfunc) hdr_subscript, /* mp_subscript */ @@ -779,6 +802,7 @@ static char hdr_doc[] = /** \ingroup python */ +/*@unchecked@*/ /*@observer@*/ PyTypeObject hdr_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ diff --git a/python/header-py.h b/python/header-py.h index 397e45fa6..d2c138f94 100644 --- a/python/header-py.h +++ b/python/header-py.h @@ -8,27 +8,42 @@ /** \ingroup python */ typedef struct hdrObject_s hdrObject; + +/*@unchecked@*/ extern PyTypeObject hdr_Type; /** \ingroup python */ PyObject * pyrpmError; -hdrObject * hdr_Wrap(Header h); - -Header hdrGetHeader(hdrObject * h); - -long tagNumFromPyObject (PyObject *item); - -PyObject * labelCompare (PyObject * self, PyObject * args); -PyObject * versionCompare (PyObject * self, PyObject * args); -PyObject * rpmMergeHeadersFromFD(PyObject * self, PyObject * args); -int rpmMergeHeaders(PyObject * list, FD_t fd, int matchTag); -PyObject * rpmHeaderFromFile(PyObject * self, PyObject * args); -PyObject * rpmHeaderFromFD(PyObject * self, PyObject * args); -PyObject * rpmReadHeaders (FD_t fd); -PyObject * rhnLoad(PyObject * self, PyObject * args); -PyObject * hdrLoad(PyObject * self, PyObject * args); -PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args); +hdrObject * hdr_Wrap(Header h) + /*@*/; + +Header hdrGetHeader(hdrObject * h) + /*@*/; + +long tagNumFromPyObject (PyObject *item) + /*@*/; + +PyObject * labelCompare (PyObject * self, PyObject * args) + /*@*/; +PyObject * versionCompare (PyObject * self, PyObject * args) + /*@*/; +PyObject * rpmMergeHeadersFromFD(PyObject * self, PyObject * args) + /*@*/; +int rpmMergeHeaders(PyObject * list, FD_t fd, int matchTag) + /*@*/; +PyObject * rpmHeaderFromFile(PyObject * self, PyObject * args) + /*@*/; +PyObject * rpmHeaderFromFD(PyObject * self, PyObject * args) + /*@*/; +PyObject * rpmReadHeaders (FD_t fd) + /*@*/; +PyObject * rhnLoad(PyObject * self, PyObject * args) + /*@*/; +PyObject * hdrLoad(PyObject * self, PyObject * args) + /*@*/; +PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args) + /*@*/; #endif diff --git a/python/rpmal-py.c b/python/rpmal-py.c index 9eb43bb50..6910bb6c2 100644 --- a/python/rpmal-py.c +++ b/python/rpmal-py.c @@ -5,6 +5,10 @@ #include "system.h" #include "Python.h" +#ifdef __LCLINT__ +#undef PyObject_HEAD +#define PyObject_HEAD int _PyObjectHead; +#endif #include <rpmlib.h> @@ -15,7 +19,9 @@ #include "debug.h" static PyObject * -rpmal_Debug(rpmalObject * s, PyObject * args) +rpmal_Debug(/*@unused@*/ rpmalObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies _Py_NoneStruct @*/ { if (!PyArg_ParseTuple(args, "i", &_rpmal_debug)) return NULL; Py_INCREF(Py_None); @@ -24,6 +30,7 @@ rpmal_Debug(rpmalObject * s, PyObject * args) static PyObject * rpmal_Add(rpmalObject * s, PyObject * args) + /*@modifies s @*/ { rpmdsObject * dso; rpmfiObject * fio; @@ -41,6 +48,8 @@ rpmal_Add(rpmalObject * s, PyObject * args) static PyObject * rpmal_Del(rpmalObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { alKey pkgKey; @@ -55,6 +64,8 @@ rpmal_Del(rpmalObject * s, PyObject * args) static PyObject * rpmal_AddProvides(rpmalObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { rpmdsObject * dso; alKey pkgKey; @@ -70,6 +81,8 @@ rpmal_AddProvides(rpmalObject * s, PyObject * args) static PyObject * rpmal_MakeIndex(rpmalObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { if (!PyArg_ParseTuple(args, ":MakeIndex")) return NULL; @@ -80,6 +93,8 @@ rpmal_MakeIndex(rpmalObject * s, PyObject * args) return Py_None; } +/*@-fullinitblock@*/ +/*@unchecked@*/ /*@observer@*/ static struct PyMethodDef rpmal_methods[] = { {"Debug", (PyCFunction)rpmal_Debug, METH_VARARGS, NULL}, @@ -91,13 +106,15 @@ static struct PyMethodDef rpmal_methods[] = { NULL}, {"makeIndex",(PyCFunction)rpmal_MakeIndex, METH_VARARGS, NULL}, - {NULL, NULL} /* sentinel */ + {NULL, NULL } /* sentinel */ }; +/*@=fullinitblock@*/ /* ---------- */ static void rpmal_dealloc(rpmalObject * s) + /*@modifies s @*/ { if (s) { s->al = rpmalFree(s->al); @@ -107,15 +124,19 @@ rpmal_dealloc(rpmalObject * s) static PyObject * rpmal_getattr(rpmalObject * s, char * name) + /*@*/ { return Py_FindMethod(rpmal_methods, (PyObject *)s, name); } /** */ +/*@unchecked@*/ /*@observer@*/ static char rpmal_doc[] = ""; +/*@-fullinitblock@*/ +/*@unchecked@*/ PyTypeObject rpmal_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ @@ -162,6 +183,7 @@ PyTypeObject rpmal_Type = { 0, /* tp_is_gc */ #endif }; +/*@=fullinitblock@*/ /* ---------- */ diff --git a/python/rpmal-py.h b/python/rpmal-py.h index a0a5b6fa1..ee79fd6cd 100644 --- a/python/rpmal-py.h +++ b/python/rpmal-py.h @@ -12,8 +12,10 @@ typedef struct rpmalObject_s { rpmal al; } rpmalObject; +/*@unchecked@*/ extern PyTypeObject rpmal_Type; -rpmalObject * rpmal_Wrap(rpmal al); +rpmalObject * rpmal_Wrap(rpmal al) + /*@*/; #endif diff --git a/python/rpmdb-py.c b/python/rpmdb-py.c index 8e689b2f3..e1da8274c 100644 --- a/python/rpmdb-py.c +++ b/python/rpmdb-py.c @@ -5,6 +5,11 @@ #include "system.h" #include "Python.h" +#ifdef __LCLINT__ +#undef PyObject_HEAD +#define PyObject_HEAD int _PyObjectHead; +#endif + #include <rpmlib.h> #include "rpmdb-py.h" @@ -13,6 +18,8 @@ #include "debug.h" +/*@access Header @*/ + /** \ingroup python * \class Rpmdb * \brief A python rpmdb object represents an RPM database. @@ -106,6 +113,8 @@ */ static rpmmiObject * rpmdb_Match (rpmdbObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { PyObject *TagN = NULL; char *key = NULL; @@ -125,17 +134,21 @@ rpmdb_Match (rpmdbObject * s, PyObject * args) /** */ +/*@-fullinitblock@*/ +/*@unchecked@*/ /*@observer@*/ static struct PyMethodDef rpmdb_methods[] = { {"match", (PyCFunction) rpmdb_Match, METH_VARARGS, "db.match([TagN, [key, [len]]]) -> mi\n\ - Create an rpm db match iterator.\n" }, {NULL, NULL} /* sentinel */ }; +/*@=fullinitblock@*/ /** */ static int rpmdb_length(rpmdbObject * s) + /*@modifies s @*/ { rpmdbMatchIterator mi; int count = 0; @@ -152,6 +165,7 @@ rpmdb_length(rpmdbObject * s) */ static hdrObject * rpmdb_subscript(rpmdbObject * s, PyObject * key) + /*@modifies s @*/ { int offset; hdrObject * ho; @@ -180,6 +194,7 @@ rpmdb_subscript(rpmdbObject * s, PyObject * key) /** */ +/*@unchecked@*/ /*@observer@*/ static PyMappingMethods rpmdb_as_mapping = { (inquiry) rpmdb_length, /* mp_length */ (binaryfunc) rpmdb_subscript, /* mp_subscript */ @@ -189,6 +204,7 @@ static PyMappingMethods rpmdb_as_mapping = { /** */ static void rpmdb_dealloc(rpmdbObject * s) + /*@modifies s @*/ { if (s->db) rpmdbClose(s->db); @@ -198,17 +214,20 @@ static void rpmdb_dealloc(rpmdbObject * s) /** */ static PyObject * rpmdb_getattr(rpmdbObject * s, char * name) + /*@*/ { return Py_FindMethod(rpmdb_methods, (PyObject * ) s, name); } /** */ +/*@unchecked@*/ /*@observer@*/ static char rpmdb_doc[] = ""; /** */ +/*@-fullinitblock@*/ PyTypeObject rpmdb_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ @@ -254,6 +273,7 @@ PyTypeObject rpmdb_Type = { 0, /* tp_is_gc */ #endif }; +/*@=fullinitblock@*/ rpmdb dbFromDb(rpmdbObject * db) { @@ -262,7 +282,7 @@ rpmdb dbFromDb(rpmdbObject * db) /** */ -rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args) { +rpmdbObject * rpmOpenDB(/*@unused@*/ PyObject * self, PyObject * args) { rpmdbObject * o; char * root = ""; int forWrite = 0; @@ -281,7 +301,9 @@ rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args) { /* PyErr_SetString should take varargs... */ errsize = strlen(errmsg) + *root == '\0' ? 15 /* "/var/lib/rpm" */ : strlen(root); errstr = alloca(errsize); +/*@-formatconst@*/ snprintf(errstr, errsize, errmsg, *root == '\0' ? "/var/lib/rpm" : root); +/*@=formatconst@*/ PyErr_SetString(pyrpmError, errstr); return NULL; } @@ -291,7 +313,7 @@ rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args) { /** */ -PyObject * rebuildDB (PyObject * self, PyObject * args) +PyObject * rebuildDB (/*@unused@*/ PyObject * self, PyObject * args) { char * root = ""; diff --git a/python/rpmdb-py.h b/python/rpmdb-py.h index f0f5793d5..8c088d5d9 100644 --- a/python/rpmdb-py.h +++ b/python/rpmdb-py.h @@ -14,18 +14,23 @@ typedef struct rpmdbObject_s rpmdbObject; /** \ingroup python */ struct rpmdbObject_s { - PyObject_HEAD; + PyObject_HEAD rpmdb db; int offx; int noffs; int *offsets; } ; +/*@unchecked@*/ extern PyTypeObject rpmdb_Type; -rpmdb dbFromDb(rpmdbObject * db); +rpmdb dbFromDb(rpmdbObject * db) + /*@*/; -rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args); -PyObject * rebuildDB (PyObject * self, PyObject * args); +rpmdbObject * rpmOpenDB(PyObject * self, PyObject * args) + /*@*/; +PyObject * rebuildDB (PyObject * self, PyObject * args) + /*@globals rpmGlobalMacroContext @*/ + /*@modifies rpmGlobalMacroContext @*/; #endif diff --git a/python/rpmds-py.c b/python/rpmds-py.c index 430947865..8ec627592 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -5,6 +5,10 @@ #include "system.h" #include "Python.h" +#ifdef __LCLINT__ +#undef PyObject_HEAD +#define PyObject_HEAD int _PyObjectHead; +#endif #include <rpmlib.h> @@ -13,8 +17,12 @@ #include "debug.h" +/*@access rpmds @*/ + static PyObject * -rpmds_Debug(rpmdsObject * s, PyObject * args) +rpmds_Debug(/*@unused@*/ rpmdsObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies _Py_NoneStruct @*/ { if (!PyArg_ParseTuple(args, "i", &_rpmds_debug)) return NULL; Py_INCREF(Py_None); @@ -23,6 +31,7 @@ rpmds_Debug(rpmdsObject * s, PyObject * args) static PyObject * rpmds_Count(rpmdsObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":Count")) return NULL; return Py_BuildValue("i", rpmdsCount(s->ds)); @@ -30,6 +39,7 @@ rpmds_Count(rpmdsObject * s, PyObject * args) static PyObject * rpmds_Ix(rpmdsObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":Ix")) return NULL; return Py_BuildValue("i", rpmdsIx(s->ds)); @@ -37,6 +47,7 @@ rpmds_Ix(rpmdsObject * s, PyObject * args) static PyObject * rpmds_DNEVR(rpmdsObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":DNEVR")) return NULL; return Py_BuildValue("s", rpmdsDNEVR(s->ds)); @@ -44,6 +55,7 @@ rpmds_DNEVR(rpmdsObject * s, PyObject * args) static PyObject * rpmds_N(rpmdsObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":N")) return NULL; return Py_BuildValue("s", rpmdsN(s->ds)); @@ -51,6 +63,7 @@ rpmds_N(rpmdsObject * s, PyObject * args) static PyObject * rpmds_EVR(rpmdsObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":EVR")) return NULL; return Py_BuildValue("s", rpmdsEVR(s->ds)); @@ -58,6 +71,7 @@ rpmds_EVR(rpmdsObject * s, PyObject * args) static PyObject * rpmds_Flags(rpmdsObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":Flags")) return NULL; return Py_BuildValue("i", rpmdsFlags(s->ds)); @@ -65,6 +79,7 @@ rpmds_Flags(rpmdsObject * s, PyObject * args) static PyObject * rpmds_TagN(rpmdsObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":TagN")) return NULL; return Py_BuildValue("i", rpmdsTagN(s->ds)); @@ -72,6 +87,7 @@ rpmds_TagN(rpmdsObject * s, PyObject * args) static int rpmds_compare(rpmdsObject * a, rpmdsObject * b) + /*@*/ { return rpmdsCompare(a->ds, b->ds); } @@ -79,6 +95,8 @@ rpmds_compare(rpmdsObject * a, rpmdsObject * b) #if Py_TPFLAGS_HAVE_ITER static PyObject * rpmds_Next(rpmdsObject * s) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { PyObject * result = NULL; @@ -105,6 +123,7 @@ rpmds_Next(rpmdsObject * s) static PyObject * rpmds_Iter(rpmdsObject * s) + /*@modifies s @*/ { rpmdsInit(s->ds); Py_INCREF(s); @@ -115,6 +134,7 @@ rpmds_Iter(rpmdsObject * s) #ifdef NOTYET static PyObject * rpmds_Notify(rpmdsObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":Notify")) return NULL; @@ -124,6 +144,7 @@ rpmds_Notify(rpmdsObject * s, PyObject * args) static PyObject * rpmds_Problem(rpmdsObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":Problem")) return NULL; @@ -132,6 +153,8 @@ rpmds_Problem(rpmdsObject * s, PyObject * args) } #endif +/*@-fullinitblock@*/ +/*@unchecked@*/ /*@observer@*/ static struct PyMethodDef rpmds_methods[] = { {"Debug", (PyCFunction)rpmds_Debug, METH_VARARGS, NULL}, @@ -163,11 +186,13 @@ static struct PyMethodDef rpmds_methods[] = { #endif {NULL, NULL} /* sentinel */ }; +/*@=fullinitblock@*/ /* ---------- */ static void rpmds_dealloc(rpmdsObject * s) + /*@modifies s @*/ { if (s) { s->ds = rpmdsFree(s->ds); @@ -176,7 +201,9 @@ rpmds_dealloc(rpmdsObject * s) } static int -rpmds_print(rpmdsObject * s, FILE * fp, int flags) +rpmds_print(rpmdsObject * s, FILE * fp, /*@unused@*/ int flags) + /*@globals fileSystem @*/ + /*@modifies s, fp, fileSystem @*/ { if (!(s && s->ds)) return -1; @@ -189,18 +216,21 @@ rpmds_print(rpmdsObject * s, FILE * fp, int flags) static PyObject * rpmds_getattr(rpmdsObject * s, char * name) + /*@*/ { return Py_FindMethod(rpmds_methods, (PyObject *)s, name); } static int rpmds_length(rpmdsObject * s) + /*@*/ { return rpmdsCount(s->ds); } static PyObject * rpmds_subscript(rpmdsObject * s, PyObject * key) + /*@modifies s @*/ { int ix; @@ -222,9 +252,11 @@ static PyMappingMethods rpmds_as_mapping = { /** */ +/*@unchecked@*/ /*@observer@*/ static char rpmds_doc[] = ""; +/*@-fullinitblock@*/ PyTypeObject rpmds_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ @@ -271,6 +303,7 @@ PyTypeObject rpmds_Type = { 0, /* tp_is_gc */ #endif }; +/*@=fullinitblock@*/ /* ---------- */ @@ -290,7 +323,7 @@ rpmds_Wrap(rpmds ds) } rpmdsObject * -rpmds_Single(PyObject * s, PyObject * args) +rpmds_Single(/*@unused@*/ PyObject * s, PyObject * args) { int tagN = RPMTAG_PROVIDENAME; const char * N; @@ -303,7 +336,7 @@ rpmds_Single(PyObject * s, PyObject * args) } rpmdsObject * -hdr_dsFromHeader(PyObject * s, PyObject * args) +hdr_dsFromHeader(/*@unused@*/ PyObject * s, PyObject * args) { hdrObject * ho; int tagN = RPMTAG_REQUIRENAME; @@ -315,7 +348,7 @@ hdr_dsFromHeader(PyObject * s, PyObject * args) } rpmdsObject * -hdr_dsOfHeader(PyObject * s, PyObject * args) +hdr_dsOfHeader(/*@unused@*/ PyObject * s, PyObject * args) { hdrObject * ho; int tagN = RPMTAG_PROVIDENAME; diff --git a/python/rpmds-py.h b/python/rpmds-py.h index edcd7eab1..9a540e14a 100644 --- a/python/rpmds-py.h +++ b/python/rpmds-py.h @@ -16,26 +16,32 @@ typedef struct rpmdsObject_s { /** */ +/*@unchecked@*/ extern PyTypeObject rpmds_Type; /** */ -rpmds dsFromDs(rpmdsObject * ds); +rpmds dsFromDs(rpmdsObject * ds) + /*@*/; /** */ -rpmdsObject * rpmds_Wrap(rpmds ds); +rpmdsObject * rpmds_Wrap(rpmds ds) + /*@*/; /** */ -rpmdsObject * rpmds_Single(PyObject * s, PyObject * args); +rpmdsObject * rpmds_Single(PyObject * s, PyObject * args) + /*@*/; /** */ -rpmdsObject * hdr_dsFromHeader(PyObject * s, PyObject * args); +rpmdsObject * hdr_dsFromHeader(PyObject * s, PyObject * args) + /*@*/; /** */ -rpmdsObject * hdr_dsOfHeader(PyObject * s, PyObject * args); +rpmdsObject * hdr_dsOfHeader(PyObject * s, PyObject * args) + /*@*/; #endif diff --git a/python/rpmfd-py.c b/python/rpmfd-py.c index 3cd9a2a25..9582cdeb5 100644 --- a/python/rpmfd-py.c +++ b/python/rpmfd-py.c @@ -5,6 +5,10 @@ #include "system.h" #include "Python.h" +#ifdef __LCLINT__ +#undef PyObject_HEAD +#define PyObject_HEAD int _PyObjectHead; +#endif #include <glob.h> /* XXX rpmio.h */ #include <dirent.h> /* XXX rpmio.h */ @@ -17,6 +21,8 @@ #include "debug.h" +/*@access FD_t @*/ + extern int _rpmio_debug; /** \ingroup python @@ -26,7 +32,9 @@ extern int _rpmio_debug; */ static PyObject * -rpmfd_Debug(rpmfdObject * s, PyObject * args) +rpmfd_Debug(/*@unused@*/ rpmfdObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies _Py_NoneStruct @*/ { if (!PyArg_ParseTuple(args, "i", &_rpmio_debug)) return NULL; Py_INCREF(Py_None); @@ -57,6 +65,8 @@ static FDlist *fdtail = NULL; /** */ static int closeCallback(FILE * f) + /*@globals fdhead @*/ + /*@modifies fdhead @*/ { FDlist *node, *last; @@ -86,7 +96,9 @@ static int closeCallback(FILE * f) /** */ static PyObject * -rpmfd_Fopen(PyObject * self, PyObject * args) +rpmfd_Fopen(/*@unused@*/ PyObject * self, PyObject * args) + /*@globals fdhead, fdtail @*/ + /*@modifies fdhead, fdtail @*/ { char * path, * mode; FDlist *node; @@ -136,6 +148,8 @@ rpmfd_Fopen(PyObject * self, PyObject * args) /** \ingroup python */ +/*@-fullinitblock@*/ +/*@unchecked@*/ /*@observer@*/ static struct PyMethodDef rpmfd_methods[] = { {"Debug", (PyCFunction)rpmfd_Debug, METH_VARARGS, NULL}, @@ -143,23 +157,27 @@ static struct PyMethodDef rpmfd_methods[] = { NULL}, {NULL, NULL} /* sentinel */ }; +/*@=fullinitblock@*/ /* ---------- */ /** \ingroup python */ static PyObject * rpmfd_getattr(rpmfdObject * o, char * name) + /*@*/ { return Py_FindMethod(rpmfd_methods, (PyObject *) o, name); } /** */ +/*@unchecked@*/ /*@observer@*/ static char rpmfd_doc[] = ""; /** \ingroup python */ +/*@-fullinitblock@*/ PyTypeObject rpmfd_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ @@ -205,6 +223,7 @@ PyTypeObject rpmfd_Type = { 0, /* tp_is_gc */ #endif }; +/*@=fullinitblock@*/ rpmfdObject * rpmfd_Wrap(FD_t fd) { diff --git a/python/rpmfd-py.h b/python/rpmfd-py.h index eed1dccc4..5ab81d692 100644 --- a/python/rpmfd-py.h +++ b/python/rpmfd-py.h @@ -10,8 +10,10 @@ typedef struct rpmfdObject_s { FD_t fd; } rpmfdObject; +/*@unchecked@*/ extern PyTypeObject rpmfd_Type; -rpmfdObject * rpmfd_Wrap(FD_t fd); +rpmfdObject * rpmfd_Wrap(FD_t fd) + /*@*/; #endif diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c index 051d2e01e..f2551cb16 100644 --- a/python/rpmfi-py.c +++ b/python/rpmfi-py.c @@ -5,6 +5,10 @@ #include "system.h" #include "Python.h" +#ifdef __LCLINT__ +#undef PyObject_HEAD +#define PyObject_HEAD int _PyObjectHead; +#endif #include <rpmlib.h> @@ -13,8 +17,12 @@ #include "debug.h" +/*@access rpmfi @*/ + static PyObject * -rpmfi_Debug(rpmfiObject * s, PyObject * args) +rpmfi_Debug(/*@unused@*/ rpmfiObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies _Py_NoneStruct @*/ { if (!PyArg_ParseTuple(args, "i", &_rpmfi_debug)) return NULL; Py_INCREF(Py_None); @@ -23,6 +31,7 @@ rpmfi_Debug(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FC(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":FC")) return NULL; return Py_BuildValue("i", rpmfiFC(s->fi)); @@ -30,6 +39,7 @@ rpmfi_FC(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FX(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":FX")) return NULL; return Py_BuildValue("i", rpmfiFX(s->fi)); @@ -37,6 +47,7 @@ rpmfi_FX(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_DC(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":DC")) return NULL; return Py_BuildValue("i", rpmfiDC(s->fi)); @@ -44,6 +55,7 @@ rpmfi_DC(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_DX(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":DX")) return NULL; return Py_BuildValue("i", rpmfiDX(s->fi)); @@ -51,6 +63,7 @@ rpmfi_DX(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_BN(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":BN")) return NULL; return Py_BuildValue("s", xstrdup(rpmfiBN(s->fi))); @@ -58,6 +71,7 @@ rpmfi_BN(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_DN(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":DN")) return NULL; return Py_BuildValue("s", xstrdup(rpmfiDN(s->fi))); @@ -65,6 +79,7 @@ rpmfi_DN(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FN(rpmfiObject * s, PyObject * args) + /*@modifies s @*/ { if (!PyArg_ParseTuple(args, ":FN")) return NULL; return Py_BuildValue("s", xstrdup(rpmfiFN(s->fi))); @@ -72,6 +87,7 @@ rpmfi_FN(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FFlags(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":FFlags")) return NULL; return Py_BuildValue("i", rpmfiFFlags(s->fi)); @@ -79,6 +95,7 @@ rpmfi_FFlags(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_VFlags(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":VFlags")) return NULL; return Py_BuildValue("i", rpmfiVFlags(s->fi)); @@ -86,6 +103,7 @@ rpmfi_VFlags(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FMode(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":FMode")) return NULL; return Py_BuildValue("i", rpmfiFMode(s->fi)); @@ -93,6 +111,7 @@ rpmfi_FMode(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FState(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":FState")) return NULL; return Py_BuildValue("i", rpmfiFState(s->fi)); @@ -101,6 +120,7 @@ rpmfi_FState(rpmfiObject * s, PyObject * args) /* XXX rpmfiMD5 */ static PyObject * rpmfi_MD5(rpmfiObject * s, PyObject * args) + /*@*/ { const unsigned char * md5; char fmd5[33]; @@ -117,6 +137,7 @@ rpmfi_MD5(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FLink(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":FLink")) return NULL; return Py_BuildValue("s", xstrdup(rpmfiFLink(s->fi))); @@ -124,6 +145,7 @@ rpmfi_FLink(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FSize(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":FSize")) return NULL; return Py_BuildValue("i", rpmfiFSize(s->fi)); @@ -131,6 +153,7 @@ rpmfi_FSize(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FRdev(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":FRdev")) return NULL; return Py_BuildValue("i", rpmfiFRdev(s->fi)); @@ -138,6 +161,7 @@ rpmfi_FRdev(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FMtime(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":FMtime")) return NULL; return Py_BuildValue("i", rpmfiFMtime(s->fi)); @@ -145,6 +169,7 @@ rpmfi_FMtime(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FUser(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":FUser")) return NULL; return Py_BuildValue("s", xstrdup(rpmfiFUser(s->fi))); @@ -152,6 +177,7 @@ rpmfi_FUser(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_FGroup(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":FGroup")) return NULL; return Py_BuildValue("s", xstrdup(rpmfiFGroup(s->fi))); @@ -159,7 +185,8 @@ rpmfi_FGroup(rpmfiObject * s, PyObject * args) #if Py_TPFLAGS_HAVE_ITER static PyObject * -rpmfi_Next(rpmfiObject * s, PyObject * args) +rpmfi_Next(rpmfiObject * s, /*@unused@*/ PyObject * args) + /*@modifies s @*/ { PyObject * result = NULL; @@ -183,7 +210,8 @@ rpmfi_Next(rpmfiObject * s, PyObject * args) } static PyObject * -rpmfi_Iter(rpmfiObject * s, PyObject * args) +rpmfi_Iter(rpmfiObject * s, /*@unused@*/ PyObject * args) + /*@modifies s @*/ { rpmfiInit(s->fi, 0); Py_INCREF(s); @@ -194,6 +222,7 @@ rpmfi_Iter(rpmfiObject * s, PyObject * args) #ifdef NOTYET static PyObject * rpmfi_NextD(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":NextD")) return NULL; @@ -203,6 +232,7 @@ rpmfi_NextD(rpmfiObject * s, PyObject * args) static PyObject * rpmfi_InitD(rpmfiObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":InitD")) return NULL; @@ -211,6 +241,8 @@ rpmfi_InitD(rpmfiObject * s, PyObject * args) } #endif +/*@-fullinitblock@*/ +/*@unchecked@*/ /*@observer@*/ static struct PyMethodDef rpmfi_methods[] = { {"Debug", (PyCFunction)rpmfi_Debug, METH_VARARGS, NULL}, @@ -264,11 +296,13 @@ static struct PyMethodDef rpmfi_methods[] = { #endif {NULL, NULL} /* sentinel */ }; +/*@=fullinitblock@*/ /* ---------- */ static void -rpmfi_dealloc(rpmfiObject * s) +rpmfi_dealloc(/*@only@*/ /*@null@*/ rpmfiObject * s) + /*@modifies s @*/ { if (s) { s->fi = rpmfiFree(s->fi, 1); @@ -277,7 +311,9 @@ rpmfi_dealloc(rpmfiObject * s) } static int -rpmfi_print(rpmfiObject * s, FILE * fp, int flags) +rpmfi_print(rpmfiObject * s, FILE * fp, /*@unused@*/ int flags) + /*@globals fileSystem @*/ + /*@modifies s, fp, fileSystem @*/ { if (!(s && s->fi)) return -1; @@ -290,18 +326,21 @@ rpmfi_print(rpmfiObject * s, FILE * fp, int flags) static PyObject * rpmfi_getattr(rpmfiObject * s, char * name) + /*@*/ { return Py_FindMethod(rpmfi_methods, (PyObject *)s, name); } static int rpmfi_length(rpmfiObject * s) + /*@*/ { return rpmfiFC(s->fi); } static PyObject * rpmfi_subscript(rpmfiObject * s, PyObject * key) + /*@modifies s @*/ { int ix; @@ -315,6 +354,7 @@ rpmfi_subscript(rpmfiObject * s, PyObject * key) return Py_BuildValue("s", xstrdup(rpmfiFN(s->fi))); } +/*@unchecked@*/ /*@observer@*/ static PyMappingMethods rpmfi_as_mapping = { (inquiry) rpmfi_length, /* mp_length */ (binaryfunc) rpmfi_subscript, /* mp_subscript */ @@ -323,9 +363,11 @@ static PyMappingMethods rpmfi_as_mapping = { /** */ +/*@unchecked@*/ /*@observer@*/ static char rpmfi_doc[] = ""; +/*@-fullinitblock@*/ PyTypeObject rpmfi_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ @@ -372,6 +414,7 @@ PyTypeObject rpmfi_Type = { 0, /* tp_is_gc */ #endif }; +/*@=fullinitblock@*/ /* ---------- */ @@ -391,7 +434,7 @@ rpmfi_Wrap(rpmfi fi) } rpmfiObject * -hdr_fiFromHeader(PyObject * s, PyObject * args) +hdr_fiFromHeader(/*@unused@*/ PyObject * s, PyObject * args) { hdrObject * ho; diff --git a/python/rpmfi-py.h b/python/rpmfi-py.h index 8b1c9e23f..b8dd4adc6 100644 --- a/python/rpmfi-py.h +++ b/python/rpmfi-py.h @@ -12,12 +12,16 @@ typedef struct rpmfiObject_s { rpmfi fi; } rpmfiObject; +/*@unchecked@*/ extern PyTypeObject rpmfi_Type; -rpmfi fiFromFi(rpmfiObject * fi); +rpmfi fiFromFi(rpmfiObject * fi) + /*@*/; -rpmfiObject * rpmfi_Wrap(rpmfi fi); +rpmfiObject * rpmfi_Wrap(rpmfi fi) + /*@*/; -rpmfiObject * hdr_fiFromHeader(PyObject * s, PyObject * args); +rpmfiObject * hdr_fiFromHeader(PyObject * s, PyObject * args) + /*@*/; #endif diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c index 2d0485433..7345ed8bb 100644 --- a/python/rpmmi-py.c +++ b/python/rpmmi-py.c @@ -5,6 +5,11 @@ #include "system.h" #include "Python.h" +#ifdef __LCLINT__ +#undef PyObject_HEAD +#define PyObject_HEAD int _PyObjectHead; +#endif + #include <rpmlib.h> #include "rpmdb-py.h" @@ -80,6 +85,7 @@ #if Py_TPFLAGS_HAVE_ITER static PyObject * rpmmi_Iter(rpmmiObject * s) + /*@*/ { assert(s->mi); Py_INCREF(s); @@ -90,6 +96,8 @@ assert(s->mi); */ static PyObject * rpmmi_Next(rpmmiObject * s) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { Header h; @@ -106,6 +114,8 @@ rpmmi_Next(rpmmiObject * s) */ static PyObject * rpmmi_Pattern(rpmmiObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { PyObject *TagN = NULL; int type; @@ -129,6 +139,8 @@ rpmmi_Pattern(rpmmiObject * s, PyObject * args) /** \ingroup python */ +/*@-fullinitblock@*/ +/*@unchecked@*/ /*@observer@*/ static struct PyMethodDef rpmmi_methods[] = { #if Py_TPFLAGS_HAVE_ITER {"iter", (PyCFunction) rpmmi_Iter, METH_VARARGS, @@ -142,10 +154,12 @@ static struct PyMethodDef rpmmi_methods[] = { - Set a secondary match pattern on tags from retrieved header.\n" }, {NULL, NULL} /* sentinel */ }; +/*@=fullinitblock@*/ /** \ingroup python */ -static void rpmmi_dealloc(rpmmiObject * s) +static void rpmmi_dealloc(/*@only@*/ /*@null@*/ rpmmiObject * s) + /*@modifies s @*/ { if (s) { if (s->mi) s->mi = rpmdbFreeIterator(s->mi); @@ -156,17 +170,20 @@ static void rpmmi_dealloc(rpmmiObject * s) /** \ingroup python */ static PyObject * rpmmi_getattr (rpmdbObject *s, char *name) + /*@*/ { return Py_FindMethod (rpmmi_methods, (PyObject *) s, name); } /** */ +/*@unchecked@*/ /*@observer@*/ static char rpmmi_doc[] = ""; /** \ingroup python */ +/*@-fullinitblock@*/ PyTypeObject rpmmi_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ @@ -212,6 +229,7 @@ PyTypeObject rpmmi_Type = { 0, /* tp_is_gc */ #endif }; +/*@=fullinitblock@*/ rpmmiObject * rpmmi_Wrap(rpmdbMatchIterator mi) { diff --git a/python/rpmmi-py.h b/python/rpmmi-py.h index 9afd3554a..68bed7bb9 100644 --- a/python/rpmmi-py.h +++ b/python/rpmmi-py.h @@ -12,12 +12,15 @@ typedef struct rpmmiObject_s rpmmiObject; /** \ingroup python */ struct rpmmiObject_s { - PyObject_HEAD; + PyObject_HEAD rpmdbMatchIterator mi; } ; +/*@unchecked@*/ extern PyTypeObject rpmmi_Type; -rpmmiObject * rpmmi_Wrap(rpmdbMatchIterator mi); +rpmmiObject * rpmmi_Wrap(rpmdbMatchIterator mi) + /*@globals _Py_NoneStruct @*/ + /*@modifies mi, _Py_NoneStruct @*/; #endif diff --git a/python/rpmmodule.c b/python/rpmmodule.c index a3827d131..49b5c42e3 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -5,6 +5,11 @@ #include "system.h" #include "Python.h" +#ifdef __LCLINT__ +#undef PyObject_HEAD +#define PyObject_HEAD int _PyObjectHead; +#endif + #include "rpmcli.h" /* XXX for rpmCheckSig */ #include "legacy.h" diff --git a/python/rpmrc-py.c b/python/rpmrc-py.c index b9bff7a3d..ad1292db9 100644 --- a/python/rpmrc-py.c +++ b/python/rpmrc-py.c @@ -5,7 +5,14 @@ #include "system.h" #include "Python.h" +#ifdef __LCLINT__ +#undef PyObject_HEAD +#define PyObject_HEAD int _PyObjectHead; +#endif + #include "structmember.h" + +/*@unchecked@*/ extern PyTypeObject PyDictIter_Type; #include <rpmcli.h> @@ -23,6 +30,7 @@ extern PyTypeObject PyDictIter_Type; #include "debug.h" +/*@unchecked@*/ static int _rc_debug = 0; /** \ingroup python @@ -38,6 +46,7 @@ static int _rc_debug = 0; /** */ static const char * lbl(void * s) + /*@*/ { PyObject * o = s; @@ -78,7 +87,7 @@ static const char * lbl(void * s) /** */ -PyObject * rpmrc_AddMacro(PyObject * self, PyObject * args) +PyObject * rpmrc_AddMacro(/*@unused@*/ PyObject * self, PyObject * args) { char * name, * val; @@ -93,7 +102,7 @@ PyObject * rpmrc_AddMacro(PyObject * self, PyObject * args) /** */ -PyObject * rpmrc_DelMacro(PyObject * self, PyObject * args) +PyObject * rpmrc_DelMacro(/*@unused@*/ PyObject * self, PyObject * args) { char * name; @@ -110,6 +119,7 @@ PyObject * rpmrc_DelMacro(PyObject * self, PyObject * args) */ static PyObject * rpmrc_getstate(rpmrcObject *s, PyObject *args) + /*@*/ { if (!PyArg_ParseTuple(args, ":getstate")) return NULL; @@ -120,6 +130,8 @@ rpmrc_getstate(rpmrcObject *s, PyObject *args) */ static PyObject * rpmrc_setstate(rpmrcObject *s, PyObject *args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { int state; @@ -133,6 +145,7 @@ rpmrc_setstate(rpmrcObject *s, PyObject *args) /** */ static void rpmrc_dealloc(PyObject * s) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_dealloc(%p[%s])\n", s, lbl(s)); @@ -142,15 +155,19 @@ fprintf(stderr, "*** rpmrc_dealloc(%p[%s])\n", s, lbl(s)); /** */ static int rpmrc_print(PyObject * s, FILE *fp, int flags) + /*@*/ { +/*@-formattype@*/ if (_rc_debug) fprintf(stderr, "*** rpmrc_print(%p[%s],%p,%x)\n", s, lbl(s), fp, flags); +/*@=formattype@*/ return PyDict_Type.tp_print(s, fp, flags); } /** */ static int rpmrc_compare(PyObject * a, PyObject * b) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_compare(%p[%s],%p[%s])\n", a, lbl(a), b, lbl(b)); @@ -160,6 +177,7 @@ fprintf(stderr, "*** rpmrc_compare(%p[%s],%p[%s])\n", a, lbl(a), b, lbl(b)); /** */ static PyObject * rpmrc_repr(PyObject * s) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_repr(%p[%s])\n", s, lbl(s)); @@ -169,6 +187,7 @@ fprintf(stderr, "*** rpmrc_repr(%p[%s])\n", s, lbl(s)); /** */ static long rpmrc_hash(PyObject * s) + /*@*/ { /* XXX dict objects are unhashable */ if (_rc_debug) @@ -180,6 +199,7 @@ fprintf(stderr, "*** rpmrc_hash(%p[%s])\n", s, lbl(s)); */ static int rpmrc_length(PyObject * s) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_length(%p[%s])\n", s, lbl(s)); @@ -190,6 +210,7 @@ fprintf(stderr, "*** rpmrc_length(%p[%s])\n", s, lbl(s)); */ static PyObject * rpmrc_subscript(PyObject * s, PyObject * key) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_subscript(%p[%s], %p[%s])\n", s, lbl(s), key, lbl(key)); @@ -200,12 +221,14 @@ fprintf(stderr, "*** rpmrc_subscript(%p[%s], %p[%s])\n", s, lbl(s), key, lbl(key */ static int rpmrc_ass_subscript(PyObject * s, PyObject * key, PyObject * value) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_ass_subscript(%p[%s], %p[%s], %p[%s])\n", s, lbl(s), key, lbl(key), value, lbl(value)); return PyDict_Type.tp_as_mapping->mp_ass_subscript(s, key, value); } +/*@unchecked@*/ /*@observer@*/ static PyMappingMethods rpmrc_as_mapping = { rpmrc_length, /* mp_length */ rpmrc_subscript, /* mp_subscript */ @@ -215,6 +238,7 @@ static PyMappingMethods rpmrc_as_mapping = { /** */ static PyObject * rpmrc_getattro (PyObject *s, PyObject *name) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_getattro(%p[%s], \"%s\")\n", s, lbl(s), PyString_AS_STRING(name)); @@ -224,6 +248,7 @@ fprintf(stderr, "*** rpmrc_getattro(%p[%s], \"%s\")\n", s, lbl(s), PyString_AS_S /** */ static int rpmrc_setattro (PyObject *s, PyObject *name, PyObject * value) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_setattro(%p[%s], \"%s \", \"%s\")\n", s, lbl(s), PyString_AS_STRING(name), PyString_AS_STRING(value)); @@ -232,12 +257,14 @@ fprintf(stderr, "*** rpmrc_setattro(%p[%s], \"%s \", \"%s\")\n", s, lbl(s), PySt /** */ +/*@unchecked@*/ /*@observer@*/ static char rpmrc_doc[] = ""; /** */ static int rpmrc_traverse(PyObject * s, visitproc visit, void *arg) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_traverse(%p[%s],%p,%p)\n", s, lbl(s), visit, arg); @@ -247,6 +274,7 @@ fprintf(stderr, "*** rpmrc_traverse(%p[%s],%p,%p)\n", s, lbl(s), visit, arg); /** */ static int rpmrc_clear(PyObject * s) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_clear(%p[%s])\n", s, lbl(s)); @@ -256,6 +284,7 @@ fprintf(stderr, "*** rpmrc_clear(%p[%s])\n", s, lbl(s)); /** */ static PyObject * rpmrc_richcompare(PyObject * v, PyObject * w, int op) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_richcompare(%p[%s],%p[%s],%x)\n", v, lbl(v), w, lbl(w), op); @@ -265,6 +294,7 @@ fprintf(stderr, "*** rpmrc_richcompare(%p[%s],%p[%s],%x)\n", v, lbl(v), w, lbl(w /** */ static PyObject * rpmrc_iter(PyObject * s) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_iter(%p[%s])\n", s, lbl(s)); @@ -276,6 +306,7 @@ fprintf(stderr, "*** rpmrc_iter(%p[%s])\n", s, lbl(s)); /** */ static PyObject * rpmrc_iternext(PyObject * s) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_iternext(%p[%s])\n", s, lbl(s)); @@ -287,6 +318,7 @@ fprintf(stderr, "*** rpmrc_iternext(%p[%s])\n", s, lbl(s)); /** */ static PyObject * rpmrc_next(PyObject * s, PyObject *args) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_next(%p[%s],%p)\n", s, lbl(s), args); @@ -295,15 +327,19 @@ fprintf(stderr, "*** rpmrc_next(%p[%s],%p)\n", s, lbl(s), args); return NULL; } +/*@-fullinitblock@*/ +/*@unchecked@*/ /*@observer@*/ static PyMemberDef rpmrc_members[] = { {"state", T_INT, offsetof(rpmrcObject, state), READONLY, "an int variable for demonstration purposes"}, {0} }; +/*@=fullinitblock@*/ /** \ingroup python */ static int rpmrc_init(PyObject * s, PyObject *args, PyObject *kwds) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_init(%p[%s],%p,%p)\n", s, lbl(s), args, kwds); @@ -316,6 +352,7 @@ fprintf(stderr, "*** rpmrc_init(%p[%s],%p,%p)\n", s, lbl(s), args, kwds); /** \ingroup python */ static void rpmrc_free(PyObject * s) + /*@*/ { if (_rc_debug) fprintf(stderr, "*** rpmrc_free(%p[%s])\n", s, lbl(s)); @@ -325,6 +362,7 @@ fprintf(stderr, "*** rpmrc_free(%p[%s])\n", s, lbl(s)); /** \ingroup python */ static PyObject * rpmrc_alloc(PyTypeObject * subtype, int nitems) + /*@*/ { PyObject * ns = PyType_GenericAlloc(subtype, nitems); @@ -336,6 +374,7 @@ fprintf(stderr, "*** rpmrc_alloc(%p[%s},%d) ret %p[%s]\n", subtype, lbl(subtype) /** \ingroup python */ static PyObject * rpmrc_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds) + /*@*/ { PyObject * ns; @@ -355,6 +394,8 @@ fprintf(stderr, "*** rpmrc_new(%p[%s],%p,%p) ret %p[%s]\n", subtype, lbl(subtype /** */ +/*@-fullinitblock@*/ +/*@unchecked@*/ /*@observer@*/ static struct PyMethodDef rpmrc_methods[] = { { "addMacro", (PyCFunction) rpmrc_AddMacro, METH_VARARGS, NULL }, @@ -368,9 +409,11 @@ static struct PyMethodDef rpmrc_methods[] = { "next() -- get the next value, or raise StopIteration"}, {NULL, NULL} /* sentinel */ }; +/*@=fullinitblock@*/ /** \ingroup python */ +/*@-fullinitblock@*/ PyTypeObject rpmrc_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ @@ -416,8 +459,9 @@ PyTypeObject rpmrc_Type = { 0, /* tp_is_gc */ #endif }; +/*@=fullinitblock@*/ -PyObject * rpmrc_Create(PyObject * self, PyObject *args, PyObject *kwds) +PyObject * rpmrc_Create(/*@unused@*/ PyObject * self, PyObject *args, PyObject *kwds) { return rpmrc_new(&rpmrc_Type, args, kwds); } diff --git a/python/rpmrc-py.h b/python/rpmrc-py.h index 649a52eda..92e95ac71 100644 --- a/python/rpmrc-py.h +++ b/python/rpmrc-py.h @@ -16,11 +16,17 @@ struct rpmrcObject_s { int state; } ; +/*@unchecked@*/ extern PyTypeObject rpmrc_Type; -PyObject * rpmrc_AddMacro(PyObject * self, PyObject * args); -PyObject * rpmrc_DelMacro(PyObject * self, PyObject * args); +PyObject * rpmrc_AddMacro(PyObject * self, PyObject * args) + /*@globals rpmGlobalMacroContext, _Py_NoneStruct @*/ + /*@modifies rpmGlobalMacroContext, _Py_NoneStruct @*/; +PyObject * rpmrc_DelMacro(PyObject * self, PyObject * args) + /*@globals rpmGlobalMacroContext, _Py_NoneStruct @*/ + /*@modifies rpmGlobalMacroContext, _Py_NoneStruct @*/; -PyObject * rpmrc_Create(PyObject * self, PyObject * args, PyObject * kwds); +PyObject * rpmrc_Create(PyObject * self, PyObject * args, PyObject * kwds) + /*@*/; #endif diff --git a/python/rpmte-py.c b/python/rpmte-py.c index b3bd7d87e..87eb54a81 100644 --- a/python/rpmte-py.c +++ b/python/rpmte-py.c @@ -5,6 +5,10 @@ #include "system.h" #include "Python.h" +#ifdef __LCLINT__ +#undef PyObject_HEAD +#define PyObject_HEAD int _PyObjectHead; +#endif #include <rpmlib.h> @@ -19,10 +23,35 @@ * \name Class: Rpmte * \class Rpmte * \brief An python rpm.te object represents an element of a transaction set. + * + * Elements of a transaction set are accessible after being added. Each + * element carries descriptive information about the added element as well + * as a file info set and dependency sets for each of the 4 typeof dependency. + * + * The rpmte class contains the following methods: + * + * - te.N() Return package name. + * - te.E() Return package epoch. + * - te.V() Return package version. + * - te.R() Return package release. + * - te.A() Return package architecture. + * - te.O() Return package operating system. + * - te.NEVR() Return package name-version-release. + * - te.Mutilib() Return package multilib attribute. + * - te.Depth() Return the level in the dependency tree (after ordering). + * - te.Npreds() Return the number of package prerequisites (after ordering). + * - te.Degree() Return the parent's degree + 1. + * - te.AddedKey() Return the packages associated key. + * - te.DS(tag) Return package dependency set. + * @param tag 'Providename', 'Requirename', 'Obsoletename', 'Conflictname' + * - te.FI(tag) Return package file info set. + * @param tag 'Basenames' */ static PyObject * -rpmte_Debug(rpmteObject * s, PyObject * args) +rpmte_Debug(/*@unused@*/ rpmteObject * s, /*@unused@*/ PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies _Py_NoneStruct @*/ { if (!PyArg_ParseTuple(args, "i", &_rpmte_debug)) return NULL; Py_INCREF(Py_None); @@ -31,6 +60,7 @@ rpmte_Debug(rpmteObject * s, PyObject * args) static PyObject * rpmte_N(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":N")) return NULL; return Py_BuildValue("s", rpmteN(s->te)); @@ -38,6 +68,7 @@ rpmte_N(rpmteObject * s, PyObject * args) static PyObject * rpmte_E(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":E")) return NULL; return Py_BuildValue("s", rpmteE(s->te)); @@ -45,6 +76,7 @@ rpmte_E(rpmteObject * s, PyObject * args) static PyObject * rpmte_V(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":V")) return NULL; return Py_BuildValue("s", rpmteV(s->te)); @@ -52,6 +84,7 @@ rpmte_V(rpmteObject * s, PyObject * args) static PyObject * rpmte_R(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":R")) return NULL; return Py_BuildValue("s", rpmteR(s->te)); @@ -59,6 +92,7 @@ rpmte_R(rpmteObject * s, PyObject * args) static PyObject * rpmte_A(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":A")) return NULL; return Py_BuildValue("s", rpmteA(s->te)); @@ -66,6 +100,7 @@ rpmte_A(rpmteObject * s, PyObject * args) static PyObject * rpmte_O(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":O")) return NULL; return Py_BuildValue("s", rpmteO(s->te)); @@ -73,6 +108,7 @@ rpmte_O(rpmteObject * s, PyObject * args) static PyObject * rpmte_NEVR(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":NEVR")) return NULL; return Py_BuildValue("s", rpmteNEVR(s->te)); @@ -80,6 +116,7 @@ rpmte_NEVR(rpmteObject * s, PyObject * args) static PyObject * rpmte_MultiLib(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":MultiLib")) return NULL; return Py_BuildValue("i", rpmteMultiLib(s->te)); @@ -87,6 +124,7 @@ rpmte_MultiLib(rpmteObject * s, PyObject * args) static PyObject * rpmte_Depth(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":Depth")) return NULL; return Py_BuildValue("i", rpmteDepth(s->te)); @@ -94,6 +132,7 @@ rpmte_Depth(rpmteObject * s, PyObject * args) static PyObject * rpmte_Npreds(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":Npreds")) return NULL; return Py_BuildValue("i", rpmteNpreds(s->te)); @@ -101,6 +140,7 @@ rpmte_Npreds(rpmteObject * s, PyObject * args) static PyObject * rpmte_Degree(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":Degree")) return NULL; return Py_BuildValue("i", rpmteDegree(s->te)); @@ -108,6 +148,7 @@ rpmte_Degree(rpmteObject * s, PyObject * args) static PyObject * rpmte_AddedKey(rpmteObject * s, PyObject * args) + /*@*/ { if (!PyArg_ParseTuple(args, ":Degree")) return NULL; return Py_BuildValue("i", rpmteDegree(s->te)); @@ -115,6 +156,7 @@ rpmte_AddedKey(rpmteObject * s, PyObject * args) static PyObject * rpmte_DS(rpmteObject * s, PyObject * args) + /*@*/ { PyObject * TagN = NULL; rpmds ds; @@ -130,14 +172,20 @@ rpmte_DS(rpmteObject * s, PyObject * args) ds = rpmteDS(s->te, tag); if (ds == NULL) { +#ifdef DYING PyErr_SetString(PyExc_TypeError, "invalid ds tag"); return NULL; +#else + Py_INCREF(Py_None); + return Py_None; +#endif } - return (PyObject *) rpmds_Wrap(ds); + return (PyObject *) rpmds_Wrap(rpmdsLink(ds, "rpmte_DS")); } static PyObject * rpmte_FI(rpmteObject * s, PyObject * args) + /*@*/ { PyObject * TagN = NULL; rpmfi fi; @@ -153,31 +201,45 @@ rpmte_FI(rpmteObject * s, PyObject * args) fi = rpmteFI(s->te, tag); if (fi == NULL) { +#ifdef DYING PyErr_SetString(PyExc_TypeError, "invalid fi tag"); return NULL; +#else + Py_INCREF(Py_None); + return Py_None; +#endif } - return (PyObject *) rpmfi_Wrap(fi); + return (PyObject *) rpmfi_Wrap(rpmfiLink(fi, "rpmte_FI")); } /** \ingroup python */ +/*@-fullinitblock@*/ +/*@unchecked@*/ /*@observer@*/ static struct PyMethodDef rpmte_methods[] = { {"Debug", (PyCFunction)rpmte_Debug, METH_VARARGS, NULL}, {"N", (PyCFunction)rpmte_N, METH_VARARGS, - NULL}, +"te.N() -> N\n\ +- Return element name.\n" }, {"E", (PyCFunction)rpmte_E, METH_VARARGS, - NULL}, +"te.E() -> E\n\ +- Return element epoch.\n" }, {"V", (PyCFunction)rpmte_V, METH_VARARGS, - NULL}, +"te.V() -> V\n\ +- Return element version.\n" }, {"R", (PyCFunction)rpmte_R, METH_VARARGS, - NULL}, +"te.R() -> R\n\ +- Return element release.\n" }, {"A", (PyCFunction)rpmte_A, METH_VARARGS, - NULL}, +"te.A() -> A\n\ +- Return element arch.\n" }, {"O", (PyCFunction)rpmte_O, METH_VARARGS, - NULL}, +"te.O() -> O\n\ +- Return element os.\n" }, {"NEVR", (PyCFunction)rpmte_NEVR, METH_VARARGS, - NULL}, +"te.NEVR() -> NEVR\n\ +- Return element name-version-release.\n" }, {"MultiLib",(PyCFunction)rpmte_MultiLib, METH_VARARGS, NULL}, {"Depth", (PyCFunction)rpmte_Depth, METH_VARARGS, @@ -189,28 +251,35 @@ static struct PyMethodDef rpmte_methods[] = { {"AddedKey",(PyCFunction)rpmte_AddedKey, METH_VARARGS, NULL}, {"DS", (PyCFunction)rpmte_DS, METH_VARARGS, - NULL}, +"te.DS(TagN) -> DS\n\ +- Return the TagN dependency set (or None). TagN is one of\n\ + 'Providename', 'Requirename', 'Obsoletename', 'Conflictname'\n" }, {"FI", (PyCFunction)rpmte_FI, METH_VARARGS, - NULL}, +"te.FI(TagN) -> FI\n\ +- Return the TagN dependency set (or None). TagN must be 'Basenames'.\n" }, {NULL, NULL} /* sentinel */ }; +/*@=fullinitblock@*/ /* ---------- */ /** \ingroup python */ static PyObject * rpmte_getattr(rpmteObject * o, char * name) + /*@*/ { return Py_FindMethod(rpmte_methods, (PyObject *) o, name); } /** */ +/*@unchecked@*/ /*@observer@*/ static char rpmte_doc[] = ""; /** \ingroup python */ +/*@-fullinitblock@*/ PyTypeObject rpmte_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ @@ -256,6 +325,7 @@ PyTypeObject rpmte_Type = { 0, /* tp_is_gc */ #endif }; +/*@=fullinitblock@*/ rpmteObject * rpmte_Wrap(rpmte te) { diff --git a/python/rpmte-py.h b/python/rpmte-py.h index 4126a66e9..18b626704 100644 --- a/python/rpmte-py.h +++ b/python/rpmte-py.h @@ -12,8 +12,10 @@ typedef struct rpmteObject_s { rpmte te; } rpmteObject; +/*@unchecked@*/ extern PyTypeObject rpmte_Type; -rpmteObject * rpmte_Wrap(rpmte te); +rpmteObject * rpmte_Wrap(rpmte te) + /*@*/; #endif diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 84c0f3f83..2e0e72de3 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -5,6 +5,10 @@ #include "system.h" #include "Python.h" +#ifdef __LCLINT__ +#undef PyObject_HEAD +#define PyObject_HEAD int _PyObjectHead; +#endif #include <rpmlib.h> @@ -20,6 +24,8 @@ #include "debug.h" +/*@access alKey @*/ + /** \ingroup python * \name Class: Rpmts * \class Rpmts @@ -146,6 +152,8 @@ static void rpmtsAddAvailableElement(rpmts ts, Header h, */ static PyObject * rpmts_AddInstall(rpmtsObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { hdrObject * h; PyObject * key; @@ -188,6 +196,8 @@ rpmts_AddInstall(rpmtsObject * s, PyObject * args) */ static PyObject * rpmts_AddErase(rpmtsObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { char * name; int count; @@ -221,6 +231,8 @@ rpmts_AddErase(rpmtsObject * s, PyObject * args) */ static PyObject * rpmts_Check(rpmtsObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { rpmps ps; rpmProblem p; @@ -306,6 +318,8 @@ rpmts_Check(rpmtsObject * s, PyObject * args) */ static PyObject * rpmts_Order(rpmtsObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { int xx; @@ -320,7 +334,63 @@ rpmts_Order(rpmtsObject * s, PyObject * args) /** \ingroup python */ static PyObject * +rpmts_Clean(rpmtsObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ +{ + int xx; + + if (!PyArg_ParseTuple(args, ":Clean")) return NULL; + + rpmtsClean(s->ts); + + Py_INCREF(Py_None); + return Py_None; +} + +/** \ingroup python + */ +static PyObject * +rpmts_OpenDB(rpmtsObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ +{ + int xx; + + if (!PyArg_ParseTuple(args, ":OpenDB")) return NULL; + + if (s->ts->dbmode == -1) + s->ts->dbmode = O_RDONLY; + xx = rpmtsOpenDB(s->ts, s->ts->dbmode); + + Py_INCREF(Py_None); + return Py_None; +} + +/** \ingroup python + */ +static PyObject * +rpmts_CloseDB(rpmtsObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ +{ + int xx; + + if (!PyArg_ParseTuple(args, ":CloseDB")) return NULL; + + xx = rpmtsCloseDB(s->ts); + s->ts->dbmode = -1; + + Py_INCREF(Py_None); + return Py_None; +} + +/** \ingroup python + */ +static PyObject * rpmts_GetKeys(rpmtsObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { const void **data = NULL; int num, i; @@ -358,9 +428,10 @@ struct rpmtsCallbackType_s { /** \ingroup python */ static void * -rpmtsCallback(const void * hd, const rpmCallbackType what, +rpmtsCallback(/*@unused@*/ const void * hd, const rpmCallbackType what, const unsigned long amount, const unsigned long total, const void * pkgKey, rpmCallbackData data) + /*@*/ { struct rpmtsCallbackType_s * cbInfo = data; PyObject * args, * result; @@ -404,6 +475,8 @@ rpmtsCallback(const void * hd, const rpmCallbackType what, /** \ingroup python */ static PyObject * rpmts_Run(rpmtsObject * s, PyObject * args) + /*@globals rpmGlobalMacroContext, _Py_NoneStruct @*/ + /*@modifies s, rpmGlobalMacroContext, _Py_NoneStruct @*/ { int flags, ignoreSet; int rc, i; @@ -455,6 +528,8 @@ static PyObject * rpmts_Run(rpmtsObject * s, PyObject * args) #if Py_TPFLAGS_HAVE_ITER static PyObject * rpmts_Next(rpmtsObject * s) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { rpmte te; @@ -474,6 +549,7 @@ rpmts_Next(rpmtsObject * s) static PyObject * rpmts_Iter(rpmtsObject * s) + /*@modifies s @*/ { s->tsi = rpmtsiInit(s->ts); s->tsiFilter = 0; @@ -486,6 +562,8 @@ rpmts_Iter(rpmtsObject * s) */ static rpmmiObject * rpmts_Match (rpmtsObject * s, PyObject * args) + /*@globals _Py_NoneStruct @*/ + /*@modifies s, _Py_NoneStruct @*/ { PyObject *TagN = NULL; char *key = NULL; @@ -514,6 +592,8 @@ rpmts_Match (rpmtsObject * s, PyObject * args) /** \ingroup python */ +/*@-fullinitblock@*/ +/*@unchecked@*/ /*@observer@*/ static struct PyMethodDef rpmts_methods[] = { {"addInstall", (PyCFunction) rpmts_AddInstall, METH_VARARGS, NULL }, @@ -523,6 +603,12 @@ static struct PyMethodDef rpmts_methods[] = { NULL }, {"order", (PyCFunction) rpmts_Order, METH_VARARGS, NULL }, + {"clean", (PyCFunction) rpmts_Clean, METH_VARARGS, + NULL }, + {"openDB", (PyCFunction) rpmts_OpenDB, METH_VARARGS, + NULL }, + {"closeDB", (PyCFunction) rpmts_CloseDB, METH_VARARGS, + NULL }, {"getKeys", (PyCFunction) rpmts_GetKeys, METH_VARARGS, NULL }, {"run", (PyCFunction) rpmts_Run, METH_VARARGS, @@ -538,10 +624,12 @@ static struct PyMethodDef rpmts_methods[] = { #endif {NULL, NULL} /* sentinel */ }; +/*@=fullinitblock@*/ /** \ingroup python */ -static void rpmts_dealloc(PyObject * o) +static void rpmts_dealloc(/*@only@*/ PyObject * o) + /*@modifies o @*/ { rpmtsObject * trans = (void *) o; @@ -560,6 +648,7 @@ static void rpmts_dealloc(PyObject * o) /** \ingroup python */ static PyObject * rpmts_getattr(rpmtsObject * o, char * name) + /*@*/ { return Py_FindMethod(rpmts_methods, (PyObject *) o, name); } @@ -567,6 +656,7 @@ static PyObject * rpmts_getattr(rpmtsObject * o, char * name) /** \ingroup python */ static int rpmts_setattr(rpmtsObject * o, char * name, PyObject * val) + /*@modifies o @*/ { int i; @@ -589,11 +679,13 @@ static int rpmts_setattr(rpmtsObject * o, char * name, PyObject * val) /** */ +/*@unchecked@*/ /*@observer@*/ static char rpmts_doc[] = ""; /** \ingroup python */ +/*@-fullinitblock@*/ PyTypeObject rpmts_Type = { PyObject_HEAD_INIT(NULL) 0, /* ob_size */ @@ -639,11 +731,12 @@ PyTypeObject rpmts_Type = { 0, /* tp_is_gc */ #endif }; +/*@=fullinitblock@*/ /** */ rpmtsObject * -rpmts_Create(PyObject * self, PyObject * args) +rpmts_Create(/*@unused@*/ PyObject * self, PyObject * args) { rpmtsObject * o; rpmdbObject * db = NULL; diff --git a/python/rpmts-py.h b/python/rpmts-py.h index 6dfaad1e2..9d50038dc 100644 --- a/python/rpmts-py.h +++ b/python/rpmts-py.h @@ -17,6 +17,7 @@ typedef struct rpmtsObject_s { rpmElementType tsiFilter; } rpmtsObject; +/*@unchecked@*/ extern PyTypeObject rpmts_Type; /* XXX These names/constants have been removed from the rpmlib API. */ @@ -25,6 +26,7 @@ enum { RPMDEP_SENSE_CONFLICTS /*!< conflict was found. */ }; -rpmtsObject * rpmts_Create(PyObject * s, PyObject * args); +rpmtsObject * rpmts_Create(PyObject * s, PyObject * args) + /*@*/; #endif diff --git a/python/upgrade.c b/python/upgrade.c index 0fd54eceb..5832ea001 100644 --- a/python/upgrade.c +++ b/python/upgrade.c @@ -2,11 +2,9 @@ * \file python/upgrade.c */ -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> +#include "system.h" + #include <fcntl.h> -#include <string.h> #include <glob.h> /* XXX rpmio.h */ #include <dirent.h> /* XXX rpmio.h */ @@ -17,6 +15,8 @@ #include "hash.h" #include "upgrade.h" +#include "debug.h" + #define MAXPKGS 1024 #define USEDEBUG 0 @@ -170,7 +170,7 @@ static int findPackagesWithObsoletes(rpmdb db, struct pkgSet *psp) while (obsoletesCount--) { if (rpmdbCountPackages(db, obsoletes[obsoletesCount]) > 0) { (*pip)->selected = 1; - break; + /*@innerbreak@*/ break; } } @@ -228,7 +228,7 @@ static int findUpgradePackages(rpmdb db, struct pkgSet *psp, /* already have a newer version installed */ DEBUG (("Already have newer version\n")) skipThis = 1; - break; + /*@innerbreak@*/ break; } } mi = rpmdbFreeIterator(mi); @@ -329,7 +329,7 @@ static int removeMovedFilesAlreadyHandled(struct pkgSet *psp, availFiles[i]); DEBUG (("File already in %s: %s%s\n", name, availDirs[availDirIndexes[i]], availFiles[i])) - break; + /*@innerbreak@*/ break; } } @@ -375,7 +375,7 @@ static int findPackagesWithRelocatedFiles(struct pkgSet *psp, { for (i = 0; i < availFileCount; i++) { - if (S_ISDIR(availFileModes[i])) continue; + if (S_ISDIR(availFileModes[i])) /*@innercontinue@*/ continue; if (htInTable(ht, availDirs[availDirIndexes[i]], availFiles[i])) { @@ -446,7 +446,7 @@ static int unmarkPackagesAlreadyInstalled(rpmdb db, struct pkgSet *psp) /* already have a newer version installed */ DEBUG (("Already have newer version\n")) (*pip)->selected = 0; - break; + /*@innerbreak@*/ break; } } mi = rpmdbFreeIterator(mi); |