diff options
author | jbj <devnull@localhost> | 2003-05-04 17:34:53 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2003-05-04 17:34:53 +0000 |
commit | 3db8afedc08c3f7425438ff029b5413456e6969d (patch) | |
tree | d82bdbf2827072889c0f4433778d2895c3df2ac9 | |
parent | 66964f525cee898d418d6aa0da10a785b44f6692 (diff) | |
download | rpm-3db8afedc08c3f7425438ff029b5413456e6969d.tar.gz rpm-3db8afedc08c3f7425438ff029b5413456e6969d.tar.bz2 rpm-3db8afedc08c3f7425438ff029b5413456e6969d.zip |
Use getattro/setattro throughout.
Convert to mpfprintlin from diddled mpprintln.
CVS patchset: 6811
CVS date: 2003/05/04 17:34:53
-rw-r--r-- | python/rpmal-py.c | 19 | ||||
-rw-r--r-- | python/rpmbc-py.c | 33 | ||||
-rw-r--r-- | python/rpmdb-py.c | 18 | ||||
-rw-r--r-- | python/rpmds-py.c | 27 | ||||
-rw-r--r-- | python/rpmfd-py.c | 18 | ||||
-rw-r--r-- | python/rpmfi-py.c | 17 | ||||
-rw-r--r-- | python/rpmfts-py.c | 14 | ||||
-rw-r--r-- | python/rpmmi-py.c | 18 | ||||
-rw-r--r-- | python/rpmmpw-py.c | 146 | ||||
-rw-r--r-- | python/rpmrng-py.c | 37 | ||||
-rw-r--r-- | python/rpmte-py.c | 18 | ||||
-rw-r--r-- | python/rpmts-py.c | 28 |
12 files changed, 220 insertions, 173 deletions
diff --git a/python/rpmal-py.c b/python/rpmal-py.c index 99dd060a8..74066717b 100644 --- a/python/rpmal-py.c +++ b/python/rpmal-py.c @@ -124,11 +124,16 @@ rpmal_dealloc(rpmalObject * s) } } -static PyObject * -rpmal_getattr(rpmalObject * s, char * name) +static PyObject * rpmal_getattro(PyObject * o, PyObject * n) + /*@*/ +{ + return PyObject_GenericGetAttr(o, n); +} + +static int rpmal_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { - return Py_FindMethod(rpmal_methods, (PyObject *)s, name); + return PyObject_GenericSetAttr(o, n, v); } /** @@ -146,9 +151,9 @@ PyTypeObject rpmal_Type = { sizeof(rpmalObject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ - (destructor)rpmal_dealloc, /* tp_dealloc */ + (destructor) rpmal_dealloc, /* tp_dealloc */ (printfunc)0, /* tp_print */ - (getattrfunc)rpmal_getattr, /* tp_getattr */ + (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ (cmpfunc)0, /* tp_compare */ (reprfunc)0, /* tp_repr */ @@ -158,8 +163,8 @@ PyTypeObject rpmal_Type = { (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ + (getattrofunc) rpmal_getattro, /* tp_getattro */ + (setattrofunc) rpmal_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ rpmal_doc, /* tp_doc */ diff --git a/python/rpmbc-py.c b/python/rpmbc-py.c index a1333f62e..d897a14f8 100644 --- a/python/rpmbc-py.c +++ b/python/rpmbc-py.c @@ -128,11 +128,16 @@ static struct PyMethodDef rpmbc_methods[] = { }; /*@=fullinitblock@*/ -static PyObject * -rpmbc_getattr(PyObject * s, char * name) +static PyObject * rpmbc_getattro(PyObject * o, PyObject * n) + /*@*/ +{ + return PyObject_GenericGetAttr(o, n); +} + +static int rpmbc_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { - return Py_FindMethod(rpmbc_methods, s, name); + return PyObject_GenericSetAttr(o, n, v); } /* ---------- */ @@ -153,18 +158,18 @@ PyTypeObject rpmbc_Type = { /* methods */ (destructor) rpmbc_dealloc, /* tp_dealloc */ (printfunc) rpmbc_print, /* tp_print */ - (getattrfunc) rpmbc_getattr, /* tp_getattr */ - (setattrfunc) 0, /* tp_setattr */ - (cmpfunc) 0, /* tp_compare */ - (reprfunc) 0, /* tp_repr */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ - (hashfunc) 0, /* tp_hash */ - (ternaryfunc) 0, /* tp_call */ - (reprfunc) 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc) rpmbc_getattro, /* tp_getattro */ + (setattrofunc) rpmbc_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ rpmbc_doc, /* tp_doc */ @@ -173,8 +178,8 @@ PyTypeObject rpmbc_Type = { 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ - (getiterfunc) 0, /* tp_iter */ - (iternextfunc) 0, /* tp_iternext */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ rpmbc_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ diff --git a/python/rpmdb-py.c b/python/rpmdb-py.c index 85b3a59be..6373cd1b6 100644 --- a/python/rpmdb-py.c +++ b/python/rpmdb-py.c @@ -213,12 +213,16 @@ static void rpmdb_dealloc(rpmdbObject * s) PyObject_Del(s); } -/** - */ -static PyObject * rpmdb_getattr(rpmdbObject * s, char * name) +static PyObject * rpmdb_getattro(PyObject * o, PyObject * n) + /*@*/ +{ + return PyObject_GenericGetAttr(o, n); +} + +static int rpmdb_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { - return Py_FindMethod(rpmdb_methods, (PyObject * ) s, name); + return PyObject_GenericSetAttr(o, n, v); } /** @@ -238,7 +242,7 @@ PyTypeObject rpmdb_Type = { 0, /* tp_itemsize */ (destructor) rpmdb_dealloc, /* tp_dealloc */ 0, /* tp_print */ - (getattrfunc) rpmdb_getattr, /* tp_getattr */ + (getattrfunc)0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ @@ -248,8 +252,8 @@ PyTypeObject rpmdb_Type = { 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ + (getattrofunc) rpmdb_getattro, /* tp_getattro */ + (setattrofunc) rpmdb_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ rpmdb_doc, /* tp_doc */ diff --git a/python/rpmds-py.c b/python/rpmds-py.c index 624a2b5cf..7862db4c8 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -274,11 +274,16 @@ rpmds_print(rpmdsObject * s, FILE * fp, /*@unused@*/ int flags) return 0; } -static PyObject * -rpmds_getattr(rpmdsObject * s, char * name) +static PyObject * rpmds_getattro(PyObject * o, PyObject * n) + /*@*/ +{ + return PyObject_GenericGetAttr(o, n); +} + +static int rpmds_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { - return Py_FindMethod(rpmds_methods, (PyObject *)s, name); + return PyObject_GenericSetAttr(o, n, v); } static int @@ -328,18 +333,18 @@ PyTypeObject rpmds_Type = { /* methods */ (destructor) rpmds_dealloc, /* tp_dealloc */ (printfunc) rpmds_print, /* tp_print */ - (getattrfunc) rpmds_getattr, /* tp_getattr */ - (setattrfunc) 0, /* tp_setattr */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ (cmpfunc) rpmds_compare, /* tp_compare */ - (reprfunc) 0, /* tp_repr */ + (reprfunc)0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ &rpmds_as_mapping, /* tp_as_mapping */ - (hashfunc) 0, /* tp_hash */ - (ternaryfunc) 0, /* tp_call */ - (reprfunc) 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc) rpmds_getattro, /* tp_getattro */ + (setattrofunc) rpmds_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ rpmds_doc, /* tp_doc */ diff --git a/python/rpmfd-py.c b/python/rpmfd-py.c index dafc0aa4d..354797887 100644 --- a/python/rpmfd-py.c +++ b/python/rpmfd-py.c @@ -176,12 +176,16 @@ rpmfd_dealloc(/*@only@*/ /*@null@*/ rpmfdObject * s) } } -/** \ingroup py_c - */ -static PyObject * rpmfd_getattr(rpmfdObject * o, char * name) +static PyObject * rpmfd_getattro(PyObject * o, PyObject * n) + /*@*/ +{ + return PyObject_GenericGetAttr(o, n); +} + +static int rpmfd_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { - return Py_FindMethod(rpmfd_methods, (PyObject *) o, name); + return PyObject_GenericSetAttr(o, n, v); } /** \ingroup py_c @@ -278,7 +282,7 @@ PyTypeObject rpmfd_Type = { /* methods */ (destructor) rpmfd_dealloc, /* tp_dealloc */ 0, /* tp_print */ - (getattrfunc) rpmfd_getattr, /* tp_getattr */ + (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ (cmpfunc)0, /* tp_compare */ (reprfunc)0, /* tp_repr */ @@ -288,8 +292,8 @@ PyTypeObject rpmfd_Type = { (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ + (getattrofunc) rpmfd_getattro, /* tp_getattro */ + (setattrofunc) rpmfd_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ rpmfd_doc, /* tp_doc */ diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c index 314c472de..54af9626d 100644 --- a/python/rpmfi-py.c +++ b/python/rpmfi-py.c @@ -416,11 +416,16 @@ rpmfi_print(rpmfiObject * s, FILE * fp, /*@unused@*/ int flags) return 0; } -static PyObject * -rpmfi_getattr(rpmfiObject * s, char * name) +static PyObject * rpmfi_getattro(PyObject * o, PyObject * n) + /*@*/ +{ + return PyObject_GenericGetAttr(o, n); +} + +static int rpmfi_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { - return Py_FindMethod(rpmfi_methods, (PyObject *)s, name); + return PyObject_GenericSetAttr(o, n, v); } static int @@ -469,7 +474,7 @@ PyTypeObject rpmfi_Type = { /* methods */ (destructor) rpmfi_dealloc, /* tp_dealloc */ (printfunc) rpmfi_print, /* tp_print */ - (getattrfunc) rpmfi_getattr, /* tp_getattr */ + (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ (cmpfunc)0, /* tp_compare */ (reprfunc)0, /* tp_repr */ @@ -479,8 +484,8 @@ PyTypeObject rpmfi_Type = { (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ + (getattrofunc) rpmfi_getattro, /* tp_getattro */ + (setattrofunc) rpmfi_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ rpmfi_doc, /* tp_doc */ diff --git a/python/rpmfts-py.c b/python/rpmfts-py.c index f95a7417e..4388aa2f5 100644 --- a/python/rpmfts-py.c +++ b/python/rpmfts-py.c @@ -121,7 +121,7 @@ rpmfts_debug(__FUNCTION__, s); case RPMFTS_OPEN: if (s->ftsp == NULL) { Py_BEGIN_ALLOW_THREADS - s->ftsp = Fts_open((char *const *)s->roots, s->options, (int (*)())s->compare); + s->ftsp = Fts_open((char *const *)s->roots, s->options, (int (*)(const FTSENT **, const FTSENT **))s->compare); Py_END_ALLOW_THREADS } break; @@ -302,18 +302,18 @@ static PyMemberDef rpmfts_members[] = { {NULL, 0, 0, 0, NULL} }; -static PyObject * rpmfts_getattro(rpmftsObject * s, PyObject * n) +static PyObject * rpmfts_getattro(PyObject * o, PyObject * n) /*@*/ { -rpmfts_debug(__FUNCTION__, s); - return PyObject_GenericGetAttr((PyObject *)s, n); +rpmfts_debug(__FUNCTION__, (rpmftsObject *)o); + return PyObject_GenericGetAttr(o, n); } -static int rpmfts_setattro(rpmftsObject * s, PyObject * n, PyObject * v) +static int rpmfts_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { -rpmfts_debug(__FUNCTION__, s); - return PyObject_GenericSetAttr((PyObject *)s, n, v); +rpmfts_debug(__FUNCTION__, (rpmftsObject *)o); + return PyObject_GenericSetAttr(o, n, v); } /* ---------- */ diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c index aa37b2b3f..3023968e7 100644 --- a/python/rpmmi-py.c +++ b/python/rpmmi-py.c @@ -211,12 +211,16 @@ static void rpmmi_dealloc(/*@only@*/ /*@null@*/ rpmmiObject * s) } } -/** \ingroup py_c - */ -static PyObject * rpmmi_getattr (rpmmiObject *s, char *name) +static PyObject * rpmmi_getattro(PyObject * o, PyObject * n) + /*@*/ +{ + return PyObject_GenericGetAttr(o, n); +} + +static int rpmmi_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { - return Py_FindMethod (rpmmi_methods, (PyObject *) s, name); + return PyObject_GenericSetAttr(o, n, v); } /** @@ -236,7 +240,7 @@ PyTypeObject rpmmi_Type = { 0, /* tp_itemsize */ (destructor) rpmmi_dealloc, /* tp_dealloc */ 0, /* tp_print */ - (getattrfunc) rpmmi_getattr, /* tp_getattr */ + (getattrfunc)0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ @@ -246,8 +250,8 @@ PyTypeObject rpmmi_Type = { 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ + (getattrofunc) rpmmi_getattro, /* tp_getattro */ + (setattrofunc) rpmmi_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ rpmmi_doc, /* tp_doc */ diff --git a/python/rpmmpw-py.c b/python/rpmmpw-py.c index 190118b8f..dbf43b711 100644 --- a/python/rpmmpw-py.c +++ b/python/rpmmpw-py.c @@ -375,7 +375,7 @@ mpstr(char * t, size_t nt, size_t zsize, mpw* zdata, size_t zbase) size_t result; if (_mpw_debug < -1) -fprintf(stderr, "*** mpstr(%p[%d], %p[%d], %d):\t", t, nt, zdata, zsize, zbase), mpprintln(stderr, zsize, zdata); +fprintf(stderr, "*** mpstr(%p[%d], %p[%d], %d):\t", t, nt, zdata, zsize, zbase), mpfprintln(stderr, zsize, zdata); mpsetx(size, bdata, zsize, zdata); @@ -383,15 +383,15 @@ fprintf(stderr, "*** mpstr(%p[%d], %p[%d], %d):\t", t, nt, zdata, zsize, zbase), while (nt--) { mpsetx(size, adata, size, bdata); if (_mpw_debug < -1) -fprintf(stderr, "*** a: %p[%d]\t", adata, size), mpprintln(stderr, size, adata); +fprintf(stderr, "*** a: %p[%d]\t", adata, size), mpfprintln(stderr, size, adata); mpnmod(bdata, size, adata, 1, &zbase, wksp); if (_mpw_debug < -1) -fprintf(stderr, "*** nmod: %p[%d]\t", bdata, size), mpprintln(stderr, size, bdata); +fprintf(stderr, "*** nmod: %p[%d]\t", bdata, size), mpfprintln(stderr, size, bdata); result = bdata[size-1]; t[nt] = mpwhars[result]; mpndivmod(bdata, size, adata, 1, &zbase, wksp); if (_mpw_debug < -1) -fprintf(stderr, "*** ndivmod: %p[%d]\t", bdata, size), mpprintln(stderr, size, bdata); +fprintf(stderr, "*** ndivmod: %p[%d]\t", bdata, size), mpfprintln(stderr, size, bdata); if (mpz(size, bdata)) break; } @@ -420,7 +420,7 @@ mpw_format(mpwObject * z, size_t zbase, int withname) } if (_mpw_debug < -1) -fprintf(stderr, "*** mpw_format(%p,%d,%d):\t", z, zbase, withname), mpprintln(stderr, z->n.size, z->n.data); +fprintf(stderr, "*** mpw_format(%p,%d,%d):\t", z, zbase, withname), mpfprintln(stderr, z->n.size, z->n.data); assert(zbase >= 2 && zbase <= 36); @@ -558,38 +558,38 @@ static void mpnslide(const mpnumber* n, size_t xsize, const mpw* xdata, mpsqr(result, xsize, xdata); /* x^2 temp */ mpsetx(size, slide, xsize+xsize, result); if (_mpw_debug < 0) -fprintf(stderr, "\t x^2:\t"), mpprintln(stderr, size, slide); +fprintf(stderr, "\t x^2:\t"), mpfprintln(stderr, size, slide); mpmul(result, xsize, xdata, size, slide); /* x^3 */ mpsetx(size, slide+size, xsize+size, result); if (_mpw_debug < 0) -fprintf(stderr, "\t x^3:\t"), mpprintln(stderr, size, slide+size); +fprintf(stderr, "\t x^3:\t"), mpfprintln(stderr, size, slide+size); mpmul(result, size, slide, size, slide+size); /* x^5 */ mpsetx(size, slide+2*size, size+size, result); if (_mpw_debug < 0) -fprintf(stderr, "\t x^5:\t"), mpprintln(stderr, size, slide+2*size); +fprintf(stderr, "\t x^5:\t"), mpfprintln(stderr, size, slide+2*size); mpmul(result, size, slide, size, slide+2*size); /* x^7 */ mpsetx(size, slide+3*size, size+size, result); if (_mpw_debug < 0) -fprintf(stderr, "\t x^7:\t"), mpprintln(stderr, size, slide+3*size); +fprintf(stderr, "\t x^7:\t"), mpfprintln(stderr, size, slide+3*size); mpmul(result, size, slide, size, slide+3*size); /* x^9 */ mpsetx(size, slide+4*size, size+size, result); if (_mpw_debug < 0) -fprintf(stderr, "\t x^9:\t"), mpprintln(stderr, size, slide+4*size); +fprintf(stderr, "\t x^9:\t"), mpfprintln(stderr, size, slide+4*size); mpmul(result, size, slide, size, slide+4*size); /* x^11 */ mpsetx(size, slide+5*size, size+size, result); if (_mpw_debug < 0) -fprintf(stderr, "\t x^11:\t"), mpprintln(stderr, size, slide+5*size); +fprintf(stderr, "\t x^11:\t"), mpfprintln(stderr, size, slide+5*size); mpmul(result, size, slide, size, slide+5*size); /* x^13 */ mpsetx(size, slide+6*size, size+size, result); if (_mpw_debug < 0) -fprintf(stderr, "\t x^13:\t"), mpprintln(stderr, size, slide+6*size); +fprintf(stderr, "\t x^13:\t"), mpfprintln(stderr, size, slide+6*size); mpmul(result, size, slide, size, slide+6*size); /* x^15 */ mpsetx(size, slide+7*size, size+size, result); if (_mpw_debug < 0) -fprintf(stderr, "\t x^15:\t"), mpprintln(stderr, size, slide+7*size); +fprintf(stderr, "\t x^15:\t"), mpfprintln(stderr, size, slide+7*size); mpsetx(size, slide, xsize, xdata); /* x^1 */ if (_mpw_debug < 0) -fprintf(stderr, "\t x^1:\t"), mpprintln(stderr, size, slide); +fprintf(stderr, "\t x^1:\t"), mpfprintln(stderr, size, slide); } /*@observer@*/ /*@unchecked@*/ @@ -620,7 +620,7 @@ static void mpnpowsld_w(mpnumber* n, size_t size, const mpw* slide, short count; if (_mpw_debug < 0) -fprintf(stderr, "npowsld: p\t"), mpprintln(stderr, psize, pdata); +fprintf(stderr, "npowsld: p\t"), mpfprintln(stderr, psize, pdata); /* 2. A = 1, i = t. */ mpzero(n->size, n->data); n->data[n->size-1] = 1; @@ -660,20 +660,20 @@ fprintf(stderr, "*** #1 lbits %d kbits %d\n", lbits, kbits); mpsqr(rdata, n->size, n->data); mpsetx(n->size, n->data, 2*n->size, rdata); if (_mpw_debug < 0) -fprintf(stderr, "\t pre1:\t"), mpprintln(stderr, n->size, n->data); +fprintf(stderr, "\t pre1:\t"), mpfprintln(stderr, n->size, n->data); } mpmul(rdata, n->size, n->data, size, slide+mpnslide_mulg[kbits]*size); mpsetx(n->size, n->data, n->size+size, rdata); if (_mpw_debug < 0) -fprintf(stderr, "\t mul1:\t"), mpprintln(stderr, n->size, n->data); +fprintf(stderr, "\t mul1:\t"), mpfprintln(stderr, n->size, n->data); for (s = mpnslide_postsq[kbits]; s > 0; s--) { mpsqr(rdata, n->size, n->data); mpsetx(n->size, n->data, 2*n->size, rdata); if (_mpw_debug < 0) -fprintf(stderr, "\tpost1:\t"), mpprintln(stderr, n->size, n->data); +fprintf(stderr, "\tpost1:\t"), mpfprintln(stderr, n->size, n->data); } lbits = kbits = 0; @@ -682,7 +682,7 @@ fprintf(stderr, "\tpost1:\t"), mpprintln(stderr, n->size, n->data); mpsqr(rdata, n->size, n->data); mpsetx(n->size, n->data, 2*n->size, rdata); if (_mpw_debug < 0) -fprintf(stderr, "\t sqr:\t"), mpprintln(stderr, n->size, n->data); +fprintf(stderr, "\t sqr:\t"), mpfprintln(stderr, n->size, n->data); } temp <<= 1; @@ -701,20 +701,20 @@ fprintf(stderr, "*** #1 lbits %d kbits %d\n", lbits, kbits); mpsqr(rdata, n->size, n->data); mpsetx(n->size, n->data, 2*n->size, rdata); if (_mpw_debug < 0) -fprintf(stderr, "\t pre2:\t"), mpprintln(stderr, n->size, n->data); +fprintf(stderr, "\t pre2:\t"), mpfprintln(stderr, n->size, n->data); } mpmul(rdata, n->size, n->data, size, slide+mpnslide_mulg[kbits]*size); mpsetx(n->size, n->data, n->size+size, rdata); if (_mpw_debug < 0) -fprintf(stderr, "\t mul2:\t"), mpprintln(stderr, n->size, n->data); +fprintf(stderr, "\t mul2:\t"), mpfprintln(stderr, n->size, n->data); for (s = mpnslide_postsq[kbits]; s > 0; s--) { mpsqr(rdata, n->size, n->data); mpsetx(n->size, n->data, 2*n->size, rdata); if (_mpw_debug < 0) -fprintf(stderr, "\tpost2:\t"), mpprintln(stderr, n->size, n->data); +fprintf(stderr, "\tpost2:\t"), mpfprintln(stderr, n->size, n->data); } } } @@ -902,7 +902,7 @@ static int mpw_init(mpwObject * s, PyObject *args, PyObject *kwds) } if (_mpw_debug) -fprintf(stderr, "*** mpw_init(%p[%s],%p[%s],%p[%s]):\t", s, lbl(s), args, lbl(args), kwds, lbl(kwds)), mpprintln(stderr, s->n.size, s->n.data); +fprintf(stderr, "*** mpw_init(%p[%s],%p[%s],%p[%s]):\t", s, lbl(s), args, lbl(args), kwds, lbl(kwds)), mpfprintln(stderr, s->n.size, s->n.data); return 0; } @@ -941,6 +941,7 @@ mpw_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds) if (_mpw_debug < -1) fprintf(stderr, "*** mpw_new(%p[%s],%p[%s],%p[%s]) ret %p[%s]\n", subtype, lbl(subtype), args, lbl(args), kwds, lbl(kwds), ns, lbl(ns)); + return ns; } @@ -994,7 +995,7 @@ mpw_ops1(const char *fname, char op, mpwObject *x) goto exit; if (_mpw_debug < 0) { -fprintf(stderr, " a %p[%d]:\t", x->n.data, x->n.size), mpprintln(stderr, x->n.size, x->n.data); +fprintf(stderr, " a %p[%d]:\t", x->n.data, x->n.size), mpfprintln(stderr, x->n.size, x->n.data); } switch (op) { @@ -1014,7 +1015,7 @@ fprintf(stderr, " a %p[%d]:\t", x->n.data, x->n.size), mpprintln(stderr, x->n } if (_mpw_debug < 0) -fprintf(stderr, "*** mpw_%s %p[%d]\t", fname, z->n.data, z->n.size), mpprintln(stderr, z->n.size, z->n.data); +fprintf(stderr, "*** mpw_%s %p[%d]\t", fname, z->n.data, z->n.size), mpfprintln(stderr, z->n.size, z->n.data); exit: mpbfree(&b); @@ -1039,8 +1040,8 @@ mpw_ops2(const char *fname, char op, mpwObject *x, mpwObject *m) goto exit; if (_mpw_debug < 0) { -fprintf(stderr, " a %p[%d]:\t", x->n.data, x->n.size), mpprintln(stderr, x->n.size, x->n.data); -fprintf(stderr, " b %p[%d]:\t", m->n.data, m->n.size), mpprintln(stderr, m->n.size, m->n.data); +fprintf(stderr, " a %p[%d]:\t", x->n.data, x->n.size), mpfprintln(stderr, x->n.size, x->n.data); +fprintf(stderr, " b %p[%d]:\t", m->n.data, m->n.size), mpfprintln(stderr, m->n.size, m->n.data); } switch (op) { @@ -1197,7 +1198,7 @@ fprintf(stderr, " b %p[%d]:\t", m->n.data, m->n.size), mpprintln(stderr, m->n } if (_mpw_debug) -fprintf(stderr, "*** mpw_%s %p[%d]\t", fname, z->n.data, z->n.size), mpprintln(stderr, z->n.size, z->n.data); +fprintf(stderr, "*** mpw_%s %p[%d]\t", fname, z->n.data, z->n.size), mpfprintln(stderr, z->n.size, z->n.data); exit: mpbfree(&b); @@ -1225,9 +1226,9 @@ mpw_ops3(const char *fname, char op, goto exit; if (_mpw_debug < 0) { -fprintf(stderr, " a %p[%d]:\t", x->n.data, x->n.size), mpprintln(stderr, x->n.size, x->n.data); -fprintf(stderr, " b %p[%d]:\t", y->n.data, y->n.size), mpprintln(stderr, y->n.size, y->n.data); -fprintf(stderr, " c %p[%d]:\t", m->n.data, m->n.size), mpprintln(stderr, m->n.size, m->n.data); +fprintf(stderr, " a %p[%d]:\t", x->n.data, x->n.size), mpfprintln(stderr, x->n.size, x->n.data); +fprintf(stderr, " b %p[%d]:\t", y->n.data, y->n.size), mpfprintln(stderr, y->n.size, y->n.data); +fprintf(stderr, " c %p[%d]:\t", m->n.data, m->n.size), mpfprintln(stderr, m->n.size, m->n.data); } mpbset(&b, m->n.size, m->n.data); @@ -1265,7 +1266,7 @@ fprintf(stderr, " c %p[%d]:\t", m->n.data, m->n.size), mpprintln(stderr, m->n mpnset(&z->n, zsize, zdata); if (_mpw_debug < 0) -fprintf(stderr, "*** mpw_%s %p[%d]\t", fname, z->n.data, z->n.size), mpprintln(stderr, z->n.size, z->n.data); +fprintf(stderr, "*** mpw_%s %p[%d]\t", fname, z->n.data, z->n.size), mpfprintln(stderr, z->n.size, z->n.data); exit: mpbfree(&b); @@ -1430,11 +1431,16 @@ static struct PyMethodDef mpw_methods[] = { }; /*@=fullinitblock@*/ -static PyObject * -mpw_getattr(PyObject * s, char * name) +static PyObject * mpw_getattro(PyObject * o, PyObject * n) + /*@*/ +{ + return PyObject_GenericGetAttr(o, n); +} + +static int mpw_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { - return Py_FindMethod(mpw_methods, s, name); + return PyObject_GenericSetAttr(o, n, v); } /* ---------- */ @@ -1530,9 +1536,9 @@ mpw_divmod(mpwObject * a, mpwObject * b) mpndivmod(zdata, asize, adata, bsize, bdata, wksp); if (_mpw_debug < 0) { -fprintf(stderr, " a %p[%d]:\t", adata, asize), mpprintln(stderr, asize, adata); -fprintf(stderr, " b %p[%d]:\t", bdata, bsize), mpprintln(stderr, bsize, bdata); -fprintf(stderr, " z %p[%d]:\t", zdata, zsize), mpprintln(stderr, zsize, zdata); +fprintf(stderr, " a %p[%d]:\t", adata, asize), mpfprintln(stderr, asize, adata); +fprintf(stderr, " b %p[%d]:\t", bdata, bsize), mpfprintln(stderr, bsize, bdata); +fprintf(stderr, " z %p[%d]:\t", zdata, zsize), mpfprintln(stderr, zsize, zdata); } zsize -= bsize; @@ -1546,8 +1552,8 @@ fprintf(stderr, " z %p[%d]:\t", zdata, zsize), mpprintln(stderr, zsize, zdata mpnset(&q->n, zsize, zdata); if (_mpw_debug) { -fprintf(stderr, " q %p[%d]:\t", q->n.data, q->n.size), mpprintln(stderr, q->n.size, q->n.data); -fprintf(stderr, " r %p[%d]:\t", r->n.data, r->n.size), mpprintln(stderr, r->n.size, r->n.data); +fprintf(stderr, " q %p[%d]:\t", q->n.data, q->n.size), mpfprintln(stderr, q->n.size, q->n.data); +fprintf(stderr, " r %p[%d]:\t", r->n.data, r->n.size), mpfprintln(stderr, r->n.size, r->n.data); fprintf(stderr, "*** mpw_divmod(%p,%p)\n", a, b); } @@ -1585,7 +1591,7 @@ mpw_positive(mpwObject * a) Py_INCREF(a); if (_mpw_debug) -fprintf(stderr, "*** mpw_positive(%p):\t", a), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_positive(%p):\t", a), mpfprintln(stderr, a->n.size, a->n.data); return (PyObject *)a; } @@ -1607,7 +1613,7 @@ mpw_absolute(mpwObject * a) } if (_mpw_debug) -fprintf(stderr, "*** mpw_absolute(%p):\t", a), mpprintln(stderr, z->n.size, z->n.data); +fprintf(stderr, "*** mpw_absolute(%p):\t", a), mpfprintln(stderr, z->n.size, z->n.data); return (PyObject *)z; } @@ -1806,7 +1812,7 @@ mpw_inplace_add(mpwObject * a, mpwObject * b) carry = mpaddx(a->n.size, a->n.data, b->n.size, b->n.data); if (_mpw_debug) -fprintf(stderr, "*** mpw_inplace_add(%p,%p):\t", a, b), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_inplace_add(%p,%p):\t", a, b), mpfprintln(stderr, a->n.size, a->n.data); Py_INCREF(a); return (PyObject *)a; @@ -1821,7 +1827,7 @@ mpw_inplace_subtract(mpwObject * a, mpwObject * b) carry = mpsubx(a->n.size, a->n.data, b->n.size, b->n.data); if (_mpw_debug) -fprintf(stderr, "*** mpw_inplace_subtract(%p,%p):\t", a, b), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_inplace_subtract(%p,%p):\t", a, b), mpfprintln(stderr, a->n.size, a->n.data); Py_INCREF(a); return (PyObject *)a; @@ -1843,7 +1849,7 @@ mpw_inplace_multiply(mpwObject * a, mpwObject * b) mpnset(&a->n, zsize, zdata); if (_mpw_debug) -fprintf(stderr, "*** mpw_inplace_multiply(%p,%p):\t", a, b), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_inplace_multiply(%p,%p):\t", a, b), mpfprintln(stderr, a->n.size, a->n.data); Py_INCREF(a); return (PyObject *)a; @@ -1878,7 +1884,7 @@ mpw_inplace_divide(mpwObject * a, mpwObject * b) mpndivmod(zdata, asize, adata, bsize, bdata, wksp); if (_mpw_debug < 0) -fprintf(stderr, "*** a %p[%d] b %p[%d] z %p[%d]\t", adata, asize, bdata, bsize, zdata, zsize), mpprintln(stderr, zsize, zdata); +fprintf(stderr, "*** a %p[%d] b %p[%d] z %p[%d]\t", adata, asize, bdata, bsize, zdata, zsize), mpfprintln(stderr, zsize, zdata); zsize -= bsize; znorm = mpsize(zsize, zdata); if (znorm < zsize) { @@ -1888,7 +1894,7 @@ fprintf(stderr, "*** a %p[%d] b %p[%d] z %p[%d]\t", adata, asize, bdata, bsize, mpnset(&a->n, zsize, zdata); if (_mpw_debug) -fprintf(stderr, "*** mpw_inplace_divide(%p,%p):\t", a, b), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_inplace_divide(%p,%p):\t", a, b), mpfprintln(stderr, a->n.size, a->n.data); Py_INCREF(a); return (PyObject *)a; @@ -1915,7 +1921,7 @@ mpw_inplace_remainder(mpwObject * a, mpwObject * b) mpnset(&a->n, zsize, zdata); if (_mpw_debug) -fprintf(stderr, "*** mpw_inplace_remainder(%p,%p):\t", a, b), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_inplace_remainder(%p,%p):\t", a, b), mpfprintln(stderr, a->n.size, a->n.data); Py_INCREF(a); return (PyObject *)a; @@ -1926,7 +1932,7 @@ mpw_inplace_power(mpwObject * a, mpwObject * b, mpwObject * c) /*@*/ { if (_mpw_debug) -fprintf(stderr, "*** mpw_inplace_power(%p,%p,%p):\t", a, b, c), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_inplace_power(%p,%p,%p):\t", a, b, c), mpfprintln(stderr, a->n.size, a->n.data); Py_INCREF(a); return (PyObject *)a; @@ -1947,7 +1953,7 @@ mpw_inplace_lshift(mpwObject * a, mpwObject * b) mplshift(a->n.size, a->n.data, count); if (_mpw_debug) -fprintf(stderr, "*** mpw_inplace_lshift(%p,%p):\t", a, b), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_inplace_lshift(%p,%p):\t", a, b), mpfprintln(stderr, a->n.size, a->n.data); Py_INCREF(a); return (PyObject *)a; @@ -1968,7 +1974,7 @@ mpw_inplace_rshift(mpwObject * a, mpwObject * b) mprshift(a->n.size, a->n.data, count); if (_mpw_debug) -fprintf(stderr, "*** mpw_inplace_rshift(%p,%p):\t", a, b), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_inplace_rshift(%p,%p):\t", a, b), mpfprintln(stderr, a->n.size, a->n.data); Py_INCREF(a); return (PyObject *)a; @@ -1986,7 +1992,7 @@ mpw_inplace_and(mpwObject * a, mpwObject * b) } if (_mpw_debug) -fprintf(stderr, "*** mpw_inplace_and(%p,%p):\t", a, b), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_inplace_and(%p,%p):\t", a, b), mpfprintln(stderr, a->n.size, a->n.data); Py_INCREF(a); return (PyObject *)a; @@ -2004,7 +2010,7 @@ mpw_inplace_xor(mpwObject * a, mpwObject * b) } if (_mpw_debug) -fprintf(stderr, "*** mpw_inplace_xor(%p,%p):\t", a, b), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_inplace_xor(%p,%p):\t", a, b), mpfprintln(stderr, a->n.size, a->n.data); Py_INCREF(a); return (PyObject *)a; @@ -2022,7 +2028,7 @@ mpw_inplace_or(mpwObject * a, mpwObject * b) } if (_mpw_debug) -fprintf(stderr, "*** mpw_inplace_or(%p,%p):\t", a, b), mpprintln(stderr, a->n.size, a->n.data); +fprintf(stderr, "*** mpw_inplace_or(%p,%p):\t", a, b), mpfprintln(stderr, a->n.size, a->n.data); Py_INCREF(a); return (PyObject *)a; @@ -2130,41 +2136,41 @@ PyTypeObject mpw_Type = { /* methods */ (destructor) mpw_dealloc, /* tp_dealloc */ (printfunc) mpw_print, /* tp_print */ - (getattrfunc) mpw_getattr, /* tp_getattr */ - (setattrfunc) 0, /* tp_setattr */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ (cmpfunc) mpw_compare, /* tp_compare */ (reprfunc) mpw_repr, /* tp_repr */ &mpw_as_number, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ - (hashfunc) 0, /* tp_hash */ - (ternaryfunc) 0, /* tp_call */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ (reprfunc) mpw_str, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ + (getattrofunc) mpw_getattro, /* tp_getattro */ + (setattrofunc) mpw_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ mpw_doc, /* tp_doc */ #if Py_TPFLAGS_HAVE_ITER - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ - (getiterfunc) 0, /* tp_iter */ - (iternextfunc) 0, /* tp_iternext */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ mpw_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ + (PyObject *)0, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc) mpw_init, /* tp_init */ (allocfunc) mpw_alloc, /* tp_alloc */ (newfunc) mpw_new, /* tp_new */ (destructor) mpw_free, /* tp_free */ - 0, /* tp_is_gc */ + (inquiry) 0, /* tp_is_gc */ #endif }; /*@=fullinitblock@*/ diff --git a/python/rpmrng-py.c b/python/rpmrng-py.c index a25457494..7c3f7b9c6 100644 --- a/python/rpmrng-py.c +++ b/python/rpmrng-py.c @@ -203,7 +203,7 @@ rng_Next(rngObject * s, PyObject * args) } if (_rng_debug) -fprintf(stderr, "*** rng_Next(%p) %p[%d]\t", s, z->n.data, z->n.size), mpprintln(stderr, z->n.size, z->n.data); +fprintf(stderr, "*** rng_Next(%p) %p[%d]\t", s, z->n.data, z->n.size), mpfprintln(stderr, z->n.size, z->n.data); return (PyObject *)z; } @@ -238,7 +238,7 @@ rng_Prime(rngObject * s, PyObject * args) mpnset(&z->n, b->size, b->modl); if (_rng_debug) -fprintf(stderr, "*** rng_Prime(%p) %p[%d]\t", s, z->n.data, z->n.size), mpprintln(stderr, z->n.size, z->n.data); +fprintf(stderr, "*** rng_Prime(%p) %p[%d]\t", s, z->n.data, z->n.size), mpfprintln(stderr, z->n.size, z->n.data); } return (PyObject *)z; @@ -259,11 +259,16 @@ static struct PyMethodDef rng_methods[] = { }; /*@=fullinitblock@*/ -static PyObject * -rng_getattr(PyObject * s, char * name) +static PyObject * rng_getattro(PyObject * o, PyObject * n) + /*@*/ +{ + return PyObject_GenericGetAttr(o, n); +} + +static int rng_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { - return Py_FindMethod(rng_methods, s, name); + return PyObject_GenericSetAttr(o, n, v); } /* ---------- */ @@ -284,18 +289,18 @@ PyTypeObject rng_Type = { /* methods */ (destructor) rng_dealloc, /* tp_dealloc */ (printfunc) rng_print, /* tp_print */ - (getattrfunc) rng_getattr, /* tp_getattr */ - (setattrfunc) 0, /* tp_setattr */ - (cmpfunc) 0, /* tp_compare */ - (reprfunc) 0, /* tp_repr */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ - (hashfunc) 0, /* tp_hash */ - (ternaryfunc) 0, /* tp_call */ - (reprfunc) 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc) rng_getattro, /* tp_getattro */ + (setattrofunc) rng_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ rng_doc, /* tp_doc */ @@ -304,8 +309,8 @@ PyTypeObject rng_Type = { 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ - (getiterfunc) 0, /* tp_iter */ - (iternextfunc) 0, /* tp_iternext */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ rng_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ diff --git a/python/rpmte-py.c b/python/rpmte-py.c index cdf6bded7..1f15102ea 100644 --- a/python/rpmte-py.c +++ b/python/rpmte-py.c @@ -372,12 +372,16 @@ rpmte_print(rpmteObject * s, FILE * fp, /*@unused@*/ int flags) return 0; } -/** \ingroup py_c - */ -static PyObject * rpmte_getattr(rpmteObject * o, char * name) +static PyObject * rpmte_getattro(PyObject * o, PyObject * n) + /*@*/ +{ + return PyObject_GenericGetAttr(o, n); +} + +static int rpmte_setattro(PyObject * o, PyObject * n, PyObject * v) /*@*/ { - return Py_FindMethod(rpmte_methods, (PyObject *) o, name); + return PyObject_GenericSetAttr(o, n, v); } /** @@ -397,7 +401,7 @@ PyTypeObject rpmte_Type = { 0, /* tp_itemsize */ (destructor)0, /* tp_dealloc */ (printfunc) rpmte_print, /* tp_print */ - (getattrfunc) rpmte_getattr, /* tp_getattr */ + (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ @@ -407,8 +411,8 @@ PyTypeObject rpmte_Type = { 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ + (getattrofunc) rpmte_getattro, /* tp_getattro */ + (setattrofunc) rpmte_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ rpmte_doc, /* tp_doc */ diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 577b5c727..eaa80d008 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -1361,29 +1361,29 @@ fprintf(stderr, "%p -- ts %p db %p\n", s, s->ts, s->ts->rdb); PyObject_Del((PyObject *)s); } -/** \ingroup py_c - */ -static PyObject * rpmts_getattr(rpmtsObject * o, char * name) +static PyObject * rpmts_getattro(PyObject * o, PyObject * n) /*@*/ { - return Py_FindMethod(rpmts_methods, (PyObject *) o, name); + return PyObject_GenericGetAttr(o, n); } /** \ingroup py_c */ -static int rpmts_setattr(rpmtsObject * o, char * name, PyObject * val) +static int rpmts_setattro(PyObject * o, PyObject * n, PyObject * v) /*@modifies o @*/ { - int i; + rpmtsObject *s = (rpmtsObject *)o; + char * name = PyString_AsString(n); + int fdno; if (!strcmp(name, "scriptFd")) { - if (!PyArg_Parse(val, "i", &i)) return 0; - if (i < 0) { + if (!PyArg_Parse(v, "i", &fdno)) return 0; + if (fdno < 0) { PyErr_SetString(PyExc_TypeError, "bad file descriptor"); return -1; } else { - o->scriptFd = fdDup(i); - rpmtsSetScriptFd(o->ts, o->scriptFd); + s->scriptFd = fdDup(fdno); + rpmtsSetScriptFd(s->ts, s->scriptFd); } } else { PyErr_SetString(PyExc_AttributeError, name); @@ -1487,8 +1487,8 @@ PyTypeObject rpmts_Type = { 0, /* tp_itemsize */ (destructor) rpmts_dealloc, /* tp_dealloc */ 0, /* tp_print */ - (getattrfunc) rpmts_getattr, /* tp_getattr */ - (setattrfunc) rpmts_setattr, /* tp_setattr */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ @@ -1497,8 +1497,8 @@ PyTypeObject rpmts_Type = { 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ + (getattrofunc) rpmts_getattro, /* tp_getattro */ + (setattrofunc) rpmts_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ rpmts_doc, /* tp_doc */ |