Commit 128358b9 authored by Jeremy Hylton's avatar Jeremy Hylton

silence compiler warnings

(2 remain)
parent 1affceb7
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: Acquisition.c,v 1.46 2001/01/16 15:39:41 jim Exp $ $Id: Acquisition.c,v 1.47 2001/02/19 19:16:07 jeremy Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -118,11 +118,11 @@ CallMethodO(PyObject *self, PyObject *name, ...@@ -118,11 +118,11 @@ CallMethodO(PyObject *self, PyObject *name,
{ {
if (! args && PyErr_Occurred()) return NULL; if (! args && PyErr_Occurred()) return NULL;
UNLESS(name=PyObject_GetAttr(self,name)) { UNLESS(name=PyObject_GetAttr(self,name)) {
if (args) Py_DECREF(args); if (args) { Py_DECREF(args); }
return NULL; return NULL;
} }
ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw)); ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw));
if (args) Py_DECREF(args); if (args) { Py_DECREF(args); }
return name; return name;
} }
...@@ -298,7 +298,7 @@ Wrapper_special(Wrapper *self, char *name, PyObject *oname) ...@@ -298,7 +298,7 @@ Wrapper_special(Wrapper *self, char *name, PyObject *oname)
case 'c': case 'c':
if (strcmp(name,"chain")==0) if (strcmp(name,"chain")==0)
{ {
if (r=PyList_New(0)) if ((r = PyList_New(0)))
while (1) while (1)
{ {
if (PyList_Append(r,OBJECT(self)) >= 0) if (PyList_Append(r,OBJECT(self)) >= 0)
...@@ -398,7 +398,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname, ...@@ -398,7 +398,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
if (PyString_Check(oname)) name=PyString_AS_STRING(oname); if (PyString_Check(oname)) name=PyString_AS_STRING(oname);
if (*name=='a' && name[1]=='q' && name[2]=='_') if (*name=='a' && name[1]=='q' && name[2]=='_')
if (r=Wrapper_special(self, name+3, oname)) if ((r=Wrapper_special(self, name+3, oname)))
{ {
if (filter) if (filter)
switch(apply_filter(filter,OBJECT(self),oname,r,extra,orig)) switch(apply_filter(filter,OBJECT(self),oname,r,extra,orig))
...@@ -425,7 +425,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname, ...@@ -425,7 +425,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
{ {
if (isWrapper(self->obj)) if (isWrapper(self->obj))
{ {
if (r=Wrapper_findattr(WRAPPER(self->obj), if ((r=Wrapper_findattr(WRAPPER(self->obj),
oname, filter, extra, orig, 1, oname, filter, extra, orig, 1,
/* Search object container if explicit, /* Search object container if explicit,
...@@ -433,8 +433,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname, ...@@ -433,8 +433,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
explicit || explicit ||
self->obj->ob_type == self->obj->ob_type ==
(PyTypeObject*)&Wrappertype, (PyTypeObject*)&Wrappertype,
explicit, containment)))
explicit, containment))
{ {
if (PyECMethod_Check(r) && PyECMethod_Self(r)==self->obj) if (PyECMethod_Check(r) && PyECMethod_Self(r)==self->obj)
ASSIGN(r,PyECMethod_New(r,OBJECT(self))); ASSIGN(r,PyECMethod_New(r,OBJECT(self)));
...@@ -525,12 +524,12 @@ Wrapper_acquire(Wrapper *self, PyObject *oname, ...@@ -525,12 +524,12 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
} }
else else
{ {
if ((r=PyObject_GetAttr(self->container,oname))) if ((r=PyObject_GetAttr(self->container,oname))) {
if (r == Acquired) if (r == Acquired)
{ {
Py_DECREF(r); Py_DECREF(r);
} }
else else {
if (filter) if (filter)
switch(apply_filter(filter,self->container,oname,r, switch(apply_filter(filter,self->container,oname,r,
extra,orig)) extra,orig))
...@@ -546,6 +545,8 @@ Wrapper_acquire(Wrapper *self, PyObject *oname, ...@@ -546,6 +545,8 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
if (has__of__(r)) ASSIGN(r,__of__(r,OBJECT(self))); if (has__of__(r)) ASSIGN(r,__of__(r,OBJECT(self)));
return r; return r;
} }
}
}
} }
} }
...@@ -566,7 +567,6 @@ Wrapper_getattro(Wrapper *self, PyObject *oname) ...@@ -566,7 +567,6 @@ Wrapper_getattro(Wrapper *self, PyObject *oname)
static PyObject * static PyObject *
Xaq_getattro(Wrapper *self, PyObject *oname) Xaq_getattro(Wrapper *self, PyObject *oname)
{ {
PyObject *r, *v, *tb;
char *name=""; char *name="";
/* Special case backward-compatible acquire method. */ /* Special case backward-compatible acquire method. */
...@@ -1425,7 +1425,7 @@ void ...@@ -1425,7 +1425,7 @@ void
initAcquisition() initAcquisition()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.46 $"; char *rev="$Revision: 1.47 $";
PURE_MIXIN_CLASS(Acquirer, PURE_MIXIN_CLASS(Acquirer,
"Base class for objects that implicitly" "Base class for objects that implicitly"
" acquire attributes from containers\n" " acquire attributes from containers\n"
...@@ -1444,7 +1444,7 @@ initAcquisition() ...@@ -1444,7 +1444,7 @@ initAcquisition()
/* Create the module and add the functions */ /* Create the module and add the functions */
m = Py_InitModule4("Acquisition", methods, m = Py_InitModule4("Acquisition", methods,
"Provide base classes for acquiring objects\n\n" "Provide base classes for acquiring objects\n\n"
"$Id: Acquisition.c,v 1.46 2001/01/16 15:39:41 jim Exp $\n", "$Id: Acquisition.c,v 1.47 2001/02/19 19:16:07 jeremy Exp $\n",
OBJECT(NULL),PYTHON_API_VERSION); OBJECT(NULL),PYTHON_API_VERSION);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: ExtensionClass.c,v 1.43 2001/01/25 21:29:15 jim Exp $ $Id: ExtensionClass.c,v 1.44 2001/02/19 19:16:07 jeremy Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n" " - They provide access to unbound methods,\n"
" - They can be called to create instances.\n" " - They can be called to create instances.\n"
"\n" "\n"
"$Id: ExtensionClass.c,v 1.43 2001/01/25 21:29:15 jim Exp $\n" "$Id: ExtensionClass.c,v 1.44 2001/02/19 19:16:07 jeremy Exp $\n"
; ;
#include <stdio.h> #include <stdio.h>
...@@ -184,7 +184,7 @@ CallMethodO(PyObject *self, PyObject *name, ...@@ -184,7 +184,7 @@ CallMethodO(PyObject *self, PyObject *name,
if (! args && PyErr_Occurred()) return NULL; if (! args && PyErr_Occurred()) return NULL;
UNLESS(name=PyObject_GetAttr(self,name)) return NULL; UNLESS(name=PyObject_GetAttr(self,name)) return NULL;
ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw)); ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw));
if (args) Py_DECREF(args); if (args) { Py_DECREF(args); }
return name; return name;
} }
...@@ -607,11 +607,12 @@ CMethod_getattro(CMethod *self, PyObject *oname) ...@@ -607,11 +607,12 @@ CMethod_getattro(CMethod *self, PyObject *oname)
{ {
ASSIGN(r, PyObject_GetAttr(r, oname)); ASSIGN(r, PyObject_GetAttr(r, oname));
if (r) if (r) {
if (UnboundCMethod_Check(r)) if (UnboundCMethod_Check(r))
ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self)); ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self));
else if (UnboundPMethod_Check(r)) else if (UnboundPMethod_Check(r))
ASSIGN(r, bindPMethod((PMethod*)r, self->self)); ASSIGN(r, bindPMethod((PMethod*)r, self->self));
}
} }
Py_DECREF(oname); Py_DECREF(oname);
return r; return r;
...@@ -921,11 +922,12 @@ PMethod_getattro(PMethod *self, PyObject *oname) ...@@ -921,11 +922,12 @@ PMethod_getattro(PMethod *self, PyObject *oname)
{ {
ASSIGN(r, PyObject_GetAttr(r, oname)); ASSIGN(r, PyObject_GetAttr(r, oname));
if (r) if (r) {
if (UnboundCMethod_Check(r)) if (UnboundCMethod_Check(r))
ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self)); ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self));
else if (UnboundPMethod_Check(r)) else if (UnboundPMethod_Check(r))
ASSIGN(r, bindPMethod((PMethod*)r, self->self)); ASSIGN(r, bindPMethod((PMethod*)r, self->self));
}
} }
Py_DECREF(oname); Py_DECREF(oname);
return r; return r;
...@@ -1080,7 +1082,6 @@ static PyObject * ...@@ -1080,7 +1082,6 @@ static PyObject *
delsetattr_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type) delsetattr_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type)
{ {
char *name; char *name;
PyObject *v;
UNLESS(PyArg_ParseTuple(args,"s",&name)) return NULL; UNLESS(PyArg_ParseTuple(args,"s",&name)) return NULL;
UNLESS(-1 != ob_type->tp_setattr(self,name,NULL)) return NULL; UNLESS(-1 != ob_type->tp_setattr(self,name,NULL)) return NULL;
Py_INCREF(Py_None); Py_INCREF(Py_None);
...@@ -1110,7 +1111,6 @@ static PyObject * ...@@ -1110,7 +1111,6 @@ static PyObject *
delsetattro_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type) delsetattro_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type)
{ {
PyObject *name; PyObject *name;
PyObject *v;
UNLESS(PyArg_ParseTuple(args,"O",&name)) return NULL; UNLESS(PyArg_ParseTuple(args,"O",&name)) return NULL;
UNLESS(-1 != ob_type->tp_setattro(self,name,NULL)) return NULL; UNLESS(-1 != ob_type->tp_setattro(self,name,NULL)) return NULL;
Py_INCREF(Py_None); Py_INCREF(Py_None);
...@@ -1661,7 +1661,9 @@ CCL_dealloc(PyExtensionClass *self) ...@@ -1661,7 +1661,9 @@ CCL_dealloc(PyExtensionClass *self)
Py_DECREF(self->bases); Py_DECREF(self->bases);
} }
if (((PyExtensionClass*)self->ob_type) != self) Py_XDECREF(self->ob_type); if (((PyExtensionClass*)self->ob_type) != self) {
Py_XDECREF(self->ob_type);
}
PyMem_DEL(self); PyMem_DEL(self);
} }
...@@ -3066,7 +3068,9 @@ subclass_dealloc(PyObject *self) ...@@ -3066,7 +3068,9 @@ subclass_dealloc(PyObject *self)
return; /* we added a reference; don't delete now */ return; /* we added a reference; don't delete now */
} }
if (HasInstDict(self)) Py_XDECREF(INSTANCE_DICT(self)); if (HasInstDict(self)) {
Py_XDECREF(INSTANCE_DICT(self));
}
/* See if there was a dealloc handler in a (C) base class. /* See if there was a dealloc handler in a (C) base class.
If there was, then it deallocates the object and we If there was, then it deallocates the object and we
...@@ -3340,8 +3344,6 @@ subclass__init__(PyExtensionClass *self, PyObject *args) ...@@ -3340,8 +3344,6 @@ subclass__init__(PyExtensionClass *self, PyObject *args)
That means that we simply copy the base class That means that we simply copy the base class
get/setattr. get/setattr.
*/ */
PyObject *r;
copy_member(tp_getattr); copy_member(tp_getattr);
copy_member(tp_getattro); copy_member(tp_getattro);
copy_member(tp_setattr); copy_member(tp_setattr);
...@@ -3528,7 +3530,7 @@ void ...@@ -3528,7 +3530,7 @@ void
initExtensionClass() initExtensionClass()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.43 $"; char *rev="$Revision: 1.44 $";
PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL); PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL);
PMethodType.ob_type=&PyType_Type; PMethodType.ob_type=&PyType_Type;
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
****************************************************************************/ ****************************************************************************/
static char Record_module_documentation[] = static char Record_module_documentation[] =
"" ""
"\n$Id: Record.c,v 1.9 2000/04/21 14:17:23 tseaver Exp $" "\n$Id: Record.c,v 1.10 2001/02/19 19:16:07 jeremy Exp $"
; ;
#ifdef PERSISTENCE #ifdef PERSISTENCE
...@@ -151,7 +151,7 @@ Record___setstate__(Record *self, PyObject *args) ...@@ -151,7 +151,7 @@ Record___setstate__(Record *self, PyObject *args)
UNLESS(PyArg_ParseTuple(args, "|OO", &state, &parent)) return NULL; UNLESS(PyArg_ParseTuple(args, "|OO", &state, &parent)) return NULL;
if(state) if(state) {
if(PyDict_Check(state)) if(PyDict_Check(state))
{ {
PyObject *k, *v; PyObject *k, *v;
...@@ -170,6 +170,7 @@ Record___setstate__(Record *self, PyObject *args) ...@@ -170,6 +170,7 @@ Record___setstate__(Record *self, PyObject *args)
UNLESS(*d) return NULL; UNLESS(*d) return NULL;
} }
} }
}
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
...@@ -262,11 +263,11 @@ Record_getattr(Record *self, PyObject *name) ...@@ -262,11 +263,11 @@ Record_getattr(Record *self, PyObject *name)
if((l=Record_init(self)) < 0) return NULL; if((l=Record_init(self)) < 0) return NULL;
if(io=Py_FindAttr((PyObject *)self, name)) return io; if ((io=Py_FindAttr((PyObject *)self, name))) return io;
PyErr_Clear(); PyErr_Clear();
if(io=PyObject_GetItem(self->schema, name)) if((io=PyObject_GetItem(self->schema, name)))
{ {
UNLESS(PyInt_Check(io)) UNLESS(PyInt_Check(io))
{ {
...@@ -296,7 +297,7 @@ Record_setattr(Record *self, PyObject *name, PyObject *v) ...@@ -296,7 +297,7 @@ Record_setattr(Record *self, PyObject *name, PyObject *v)
PyObject *io; PyObject *io;
if((l=Record_init(self)) < 0) return -1; if((l=Record_init(self)) < 0) return -1;
if(io=PyObject_GetItem(self->schema, name)) if((io=PyObject_GetItem(self->schema, name)))
{ {
UNLESS(PyInt_Check(io)) UNLESS(PyInt_Check(io))
{ {
...@@ -350,7 +351,7 @@ Record_compare(Record *v, Record *w) ...@@ -350,7 +351,7 @@ Record_compare(Record *v, Record *w)
if(*dv) if(*dv)
if(*dw) if(*dw)
{ {
if(c=PyObject_Compare(*dv,*dw)) return c; if((c=PyObject_Compare(*dv,*dw))) return c;
} }
else return 1; else return 1;
else if(*dw) return -1; else if(*dw) return -1;
...@@ -474,7 +475,7 @@ Record_subscript(Record *self, PyObject *key) ...@@ -474,7 +475,7 @@ Record_subscript(Record *self, PyObject *key)
return Record_item(self, i); return Record_item(self, i);
} }
if(io=PyObject_GetItem(self->schema, key)) if((io=PyObject_GetItem(self->schema, key)))
{ {
UNLESS(PyInt_Check(io)) UNLESS(PyInt_Check(io))
{ {
...@@ -493,7 +494,7 @@ Record_subscript(Record *self, PyObject *key) ...@@ -493,7 +494,7 @@ Record_subscript(Record *self, PyObject *key)
} }
PyErr_Clear(); PyErr_Clear();
if (io=PyObject_GetAttr(OBJECT(self), key)) return io; if ((io=PyObject_GetAttr(OBJECT(self), key))) return io;
PyErr_SetObject(PyExc_KeyError, key); PyErr_SetObject(PyExc_KeyError, key);
return NULL; return NULL;
...@@ -514,7 +515,7 @@ Record_ass_sub(Record *self, PyObject *key, PyObject *v) ...@@ -514,7 +515,7 @@ Record_ass_sub(Record *self, PyObject *key, PyObject *v)
return Record_ass_item(self, i, v); return Record_ass_item(self, i, v);
} }
if(io=PyObject_GetItem(self->schema, key)) if((io=PyObject_GetItem(self->schema, key)))
{ {
UNLESS(PyInt_Check(io)) UNLESS(PyInt_Check(io))
{ {
...@@ -592,7 +593,7 @@ void ...@@ -592,7 +593,7 @@ void
initRecord() initRecord()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.9 $"; char *rev="$Revision: 1.10 $";
UNLESS(py___record_schema__=PyString_FromString("__record_schema__")) return; UNLESS(py___record_schema__=PyString_FromString("__record_schema__")) return;
...@@ -631,6 +632,10 @@ initRecord() ...@@ -631,6 +632,10 @@ initRecord()
Revision Log: Revision Log:
$Log: Record.c,v $ $Log: Record.c,v $
Revision 1.10 2001/02/19 19:16:07 jeremy
silence compiler warnings
(2 remain)
Revision 1.9 2000/04/21 14:17:23 tseaver Revision 1.9 2000/04/21 14:17:23 tseaver
Collector #1012: Guarantee null-terminated buffer in Record_init() so Record_compare doesn't UMR Collector #1012: Guarantee null-terminated buffer in Record_init() so Record_compare doesn't UMR
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: Acquisition.c,v 1.46 2001/01/16 15:39:41 jim Exp $ $Id: Acquisition.c,v 1.47 2001/02/19 19:16:07 jeremy Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -118,11 +118,11 @@ CallMethodO(PyObject *self, PyObject *name, ...@@ -118,11 +118,11 @@ CallMethodO(PyObject *self, PyObject *name,
{ {
if (! args && PyErr_Occurred()) return NULL; if (! args && PyErr_Occurred()) return NULL;
UNLESS(name=PyObject_GetAttr(self,name)) { UNLESS(name=PyObject_GetAttr(self,name)) {
if (args) Py_DECREF(args); if (args) { Py_DECREF(args); }
return NULL; return NULL;
} }
ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw)); ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw));
if (args) Py_DECREF(args); if (args) { Py_DECREF(args); }
return name; return name;
} }
...@@ -298,7 +298,7 @@ Wrapper_special(Wrapper *self, char *name, PyObject *oname) ...@@ -298,7 +298,7 @@ Wrapper_special(Wrapper *self, char *name, PyObject *oname)
case 'c': case 'c':
if (strcmp(name,"chain")==0) if (strcmp(name,"chain")==0)
{ {
if (r=PyList_New(0)) if ((r = PyList_New(0)))
while (1) while (1)
{ {
if (PyList_Append(r,OBJECT(self)) >= 0) if (PyList_Append(r,OBJECT(self)) >= 0)
...@@ -398,7 +398,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname, ...@@ -398,7 +398,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
if (PyString_Check(oname)) name=PyString_AS_STRING(oname); if (PyString_Check(oname)) name=PyString_AS_STRING(oname);
if (*name=='a' && name[1]=='q' && name[2]=='_') if (*name=='a' && name[1]=='q' && name[2]=='_')
if (r=Wrapper_special(self, name+3, oname)) if ((r=Wrapper_special(self, name+3, oname)))
{ {
if (filter) if (filter)
switch(apply_filter(filter,OBJECT(self),oname,r,extra,orig)) switch(apply_filter(filter,OBJECT(self),oname,r,extra,orig))
...@@ -425,7 +425,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname, ...@@ -425,7 +425,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
{ {
if (isWrapper(self->obj)) if (isWrapper(self->obj))
{ {
if (r=Wrapper_findattr(WRAPPER(self->obj), if ((r=Wrapper_findattr(WRAPPER(self->obj),
oname, filter, extra, orig, 1, oname, filter, extra, orig, 1,
/* Search object container if explicit, /* Search object container if explicit,
...@@ -433,8 +433,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname, ...@@ -433,8 +433,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
explicit || explicit ||
self->obj->ob_type == self->obj->ob_type ==
(PyTypeObject*)&Wrappertype, (PyTypeObject*)&Wrappertype,
explicit, containment)))
explicit, containment))
{ {
if (PyECMethod_Check(r) && PyECMethod_Self(r)==self->obj) if (PyECMethod_Check(r) && PyECMethod_Self(r)==self->obj)
ASSIGN(r,PyECMethod_New(r,OBJECT(self))); ASSIGN(r,PyECMethod_New(r,OBJECT(self)));
...@@ -525,12 +524,12 @@ Wrapper_acquire(Wrapper *self, PyObject *oname, ...@@ -525,12 +524,12 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
} }
else else
{ {
if ((r=PyObject_GetAttr(self->container,oname))) if ((r=PyObject_GetAttr(self->container,oname))) {
if (r == Acquired) if (r == Acquired)
{ {
Py_DECREF(r); Py_DECREF(r);
} }
else else {
if (filter) if (filter)
switch(apply_filter(filter,self->container,oname,r, switch(apply_filter(filter,self->container,oname,r,
extra,orig)) extra,orig))
...@@ -546,6 +545,8 @@ Wrapper_acquire(Wrapper *self, PyObject *oname, ...@@ -546,6 +545,8 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
if (has__of__(r)) ASSIGN(r,__of__(r,OBJECT(self))); if (has__of__(r)) ASSIGN(r,__of__(r,OBJECT(self)));
return r; return r;
} }
}
}
} }
} }
...@@ -566,7 +567,6 @@ Wrapper_getattro(Wrapper *self, PyObject *oname) ...@@ -566,7 +567,6 @@ Wrapper_getattro(Wrapper *self, PyObject *oname)
static PyObject * static PyObject *
Xaq_getattro(Wrapper *self, PyObject *oname) Xaq_getattro(Wrapper *self, PyObject *oname)
{ {
PyObject *r, *v, *tb;
char *name=""; char *name="";
/* Special case backward-compatible acquire method. */ /* Special case backward-compatible acquire method. */
...@@ -1425,7 +1425,7 @@ void ...@@ -1425,7 +1425,7 @@ void
initAcquisition() initAcquisition()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.46 $"; char *rev="$Revision: 1.47 $";
PURE_MIXIN_CLASS(Acquirer, PURE_MIXIN_CLASS(Acquirer,
"Base class for objects that implicitly" "Base class for objects that implicitly"
" acquire attributes from containers\n" " acquire attributes from containers\n"
...@@ -1444,7 +1444,7 @@ initAcquisition() ...@@ -1444,7 +1444,7 @@ initAcquisition()
/* Create the module and add the functions */ /* Create the module and add the functions */
m = Py_InitModule4("Acquisition", methods, m = Py_InitModule4("Acquisition", methods,
"Provide base classes for acquiring objects\n\n" "Provide base classes for acquiring objects\n\n"
"$Id: Acquisition.c,v 1.46 2001/01/16 15:39:41 jim Exp $\n", "$Id: Acquisition.c,v 1.47 2001/02/19 19:16:07 jeremy Exp $\n",
OBJECT(NULL),PYTHON_API_VERSION); OBJECT(NULL),PYTHON_API_VERSION);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE. DAMAGE.
$Id: ExtensionClass.c,v 1.43 2001/01/25 21:29:15 jim Exp $ $Id: ExtensionClass.c,v 1.44 2001/02/19 19:16:07 jeremy Exp $
If you have questions regarding this software, If you have questions regarding this software,
contact: contact:
...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n" " - They provide access to unbound methods,\n"
" - They can be called to create instances.\n" " - They can be called to create instances.\n"
"\n" "\n"
"$Id: ExtensionClass.c,v 1.43 2001/01/25 21:29:15 jim Exp $\n" "$Id: ExtensionClass.c,v 1.44 2001/02/19 19:16:07 jeremy Exp $\n"
; ;
#include <stdio.h> #include <stdio.h>
...@@ -184,7 +184,7 @@ CallMethodO(PyObject *self, PyObject *name, ...@@ -184,7 +184,7 @@ CallMethodO(PyObject *self, PyObject *name,
if (! args && PyErr_Occurred()) return NULL; if (! args && PyErr_Occurred()) return NULL;
UNLESS(name=PyObject_GetAttr(self,name)) return NULL; UNLESS(name=PyObject_GetAttr(self,name)) return NULL;
ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw)); ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw));
if (args) Py_DECREF(args); if (args) { Py_DECREF(args); }
return name; return name;
} }
...@@ -607,11 +607,12 @@ CMethod_getattro(CMethod *self, PyObject *oname) ...@@ -607,11 +607,12 @@ CMethod_getattro(CMethod *self, PyObject *oname)
{ {
ASSIGN(r, PyObject_GetAttr(r, oname)); ASSIGN(r, PyObject_GetAttr(r, oname));
if (r) if (r) {
if (UnboundCMethod_Check(r)) if (UnboundCMethod_Check(r))
ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self)); ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self));
else if (UnboundPMethod_Check(r)) else if (UnboundPMethod_Check(r))
ASSIGN(r, bindPMethod((PMethod*)r, self->self)); ASSIGN(r, bindPMethod((PMethod*)r, self->self));
}
} }
Py_DECREF(oname); Py_DECREF(oname);
return r; return r;
...@@ -921,11 +922,12 @@ PMethod_getattro(PMethod *self, PyObject *oname) ...@@ -921,11 +922,12 @@ PMethod_getattro(PMethod *self, PyObject *oname)
{ {
ASSIGN(r, PyObject_GetAttr(r, oname)); ASSIGN(r, PyObject_GetAttr(r, oname));
if (r) if (r) {
if (UnboundCMethod_Check(r)) if (UnboundCMethod_Check(r))
ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self)); ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self));
else if (UnboundPMethod_Check(r)) else if (UnboundPMethod_Check(r))
ASSIGN(r, bindPMethod((PMethod*)r, self->self)); ASSIGN(r, bindPMethod((PMethod*)r, self->self));
}
} }
Py_DECREF(oname); Py_DECREF(oname);
return r; return r;
...@@ -1080,7 +1082,6 @@ static PyObject * ...@@ -1080,7 +1082,6 @@ static PyObject *
delsetattr_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type) delsetattr_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type)
{ {
char *name; char *name;
PyObject *v;
UNLESS(PyArg_ParseTuple(args,"s",&name)) return NULL; UNLESS(PyArg_ParseTuple(args,"s",&name)) return NULL;
UNLESS(-1 != ob_type->tp_setattr(self,name,NULL)) return NULL; UNLESS(-1 != ob_type->tp_setattr(self,name,NULL)) return NULL;
Py_INCREF(Py_None); Py_INCREF(Py_None);
...@@ -1110,7 +1111,6 @@ static PyObject * ...@@ -1110,7 +1111,6 @@ static PyObject *
delsetattro_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type) delsetattro_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type)
{ {
PyObject *name; PyObject *name;
PyObject *v;
UNLESS(PyArg_ParseTuple(args,"O",&name)) return NULL; UNLESS(PyArg_ParseTuple(args,"O",&name)) return NULL;
UNLESS(-1 != ob_type->tp_setattro(self,name,NULL)) return NULL; UNLESS(-1 != ob_type->tp_setattro(self,name,NULL)) return NULL;
Py_INCREF(Py_None); Py_INCREF(Py_None);
...@@ -1661,7 +1661,9 @@ CCL_dealloc(PyExtensionClass *self) ...@@ -1661,7 +1661,9 @@ CCL_dealloc(PyExtensionClass *self)
Py_DECREF(self->bases); Py_DECREF(self->bases);
} }
if (((PyExtensionClass*)self->ob_type) != self) Py_XDECREF(self->ob_type); if (((PyExtensionClass*)self->ob_type) != self) {
Py_XDECREF(self->ob_type);
}
PyMem_DEL(self); PyMem_DEL(self);
} }
...@@ -3066,7 +3068,9 @@ subclass_dealloc(PyObject *self) ...@@ -3066,7 +3068,9 @@ subclass_dealloc(PyObject *self)
return; /* we added a reference; don't delete now */ return; /* we added a reference; don't delete now */
} }
if (HasInstDict(self)) Py_XDECREF(INSTANCE_DICT(self)); if (HasInstDict(self)) {
Py_XDECREF(INSTANCE_DICT(self));
}
/* See if there was a dealloc handler in a (C) base class. /* See if there was a dealloc handler in a (C) base class.
If there was, then it deallocates the object and we If there was, then it deallocates the object and we
...@@ -3340,8 +3344,6 @@ subclass__init__(PyExtensionClass *self, PyObject *args) ...@@ -3340,8 +3344,6 @@ subclass__init__(PyExtensionClass *self, PyObject *args)
That means that we simply copy the base class That means that we simply copy the base class
get/setattr. get/setattr.
*/ */
PyObject *r;
copy_member(tp_getattr); copy_member(tp_getattr);
copy_member(tp_getattro); copy_member(tp_getattro);
copy_member(tp_setattr); copy_member(tp_setattr);
...@@ -3528,7 +3530,7 @@ void ...@@ -3528,7 +3530,7 @@ void
initExtensionClass() initExtensionClass()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.43 $"; char *rev="$Revision: 1.44 $";
PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL); PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL);
PMethodType.ob_type=&PyType_Type; PMethodType.ob_type=&PyType_Type;
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
****************************************************************************/ ****************************************************************************/
static char Record_module_documentation[] = static char Record_module_documentation[] =
"" ""
"\n$Id: Record.c,v 1.9 2000/04/21 14:17:23 tseaver Exp $" "\n$Id: Record.c,v 1.10 2001/02/19 19:16:07 jeremy Exp $"
; ;
#ifdef PERSISTENCE #ifdef PERSISTENCE
...@@ -151,7 +151,7 @@ Record___setstate__(Record *self, PyObject *args) ...@@ -151,7 +151,7 @@ Record___setstate__(Record *self, PyObject *args)
UNLESS(PyArg_ParseTuple(args, "|OO", &state, &parent)) return NULL; UNLESS(PyArg_ParseTuple(args, "|OO", &state, &parent)) return NULL;
if(state) if(state) {
if(PyDict_Check(state)) if(PyDict_Check(state))
{ {
PyObject *k, *v; PyObject *k, *v;
...@@ -170,6 +170,7 @@ Record___setstate__(Record *self, PyObject *args) ...@@ -170,6 +170,7 @@ Record___setstate__(Record *self, PyObject *args)
UNLESS(*d) return NULL; UNLESS(*d) return NULL;
} }
} }
}
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
...@@ -262,11 +263,11 @@ Record_getattr(Record *self, PyObject *name) ...@@ -262,11 +263,11 @@ Record_getattr(Record *self, PyObject *name)
if((l=Record_init(self)) < 0) return NULL; if((l=Record_init(self)) < 0) return NULL;
if(io=Py_FindAttr((PyObject *)self, name)) return io; if ((io=Py_FindAttr((PyObject *)self, name))) return io;
PyErr_Clear(); PyErr_Clear();
if(io=PyObject_GetItem(self->schema, name)) if((io=PyObject_GetItem(self->schema, name)))
{ {
UNLESS(PyInt_Check(io)) UNLESS(PyInt_Check(io))
{ {
...@@ -296,7 +297,7 @@ Record_setattr(Record *self, PyObject *name, PyObject *v) ...@@ -296,7 +297,7 @@ Record_setattr(Record *self, PyObject *name, PyObject *v)
PyObject *io; PyObject *io;
if((l=Record_init(self)) < 0) return -1; if((l=Record_init(self)) < 0) return -1;
if(io=PyObject_GetItem(self->schema, name)) if((io=PyObject_GetItem(self->schema, name)))
{ {
UNLESS(PyInt_Check(io)) UNLESS(PyInt_Check(io))
{ {
...@@ -350,7 +351,7 @@ Record_compare(Record *v, Record *w) ...@@ -350,7 +351,7 @@ Record_compare(Record *v, Record *w)
if(*dv) if(*dv)
if(*dw) if(*dw)
{ {
if(c=PyObject_Compare(*dv,*dw)) return c; if((c=PyObject_Compare(*dv,*dw))) return c;
} }
else return 1; else return 1;
else if(*dw) return -1; else if(*dw) return -1;
...@@ -474,7 +475,7 @@ Record_subscript(Record *self, PyObject *key) ...@@ -474,7 +475,7 @@ Record_subscript(Record *self, PyObject *key)
return Record_item(self, i); return Record_item(self, i);
} }
if(io=PyObject_GetItem(self->schema, key)) if((io=PyObject_GetItem(self->schema, key)))
{ {
UNLESS(PyInt_Check(io)) UNLESS(PyInt_Check(io))
{ {
...@@ -493,7 +494,7 @@ Record_subscript(Record *self, PyObject *key) ...@@ -493,7 +494,7 @@ Record_subscript(Record *self, PyObject *key)
} }
PyErr_Clear(); PyErr_Clear();
if (io=PyObject_GetAttr(OBJECT(self), key)) return io; if ((io=PyObject_GetAttr(OBJECT(self), key))) return io;
PyErr_SetObject(PyExc_KeyError, key); PyErr_SetObject(PyExc_KeyError, key);
return NULL; return NULL;
...@@ -514,7 +515,7 @@ Record_ass_sub(Record *self, PyObject *key, PyObject *v) ...@@ -514,7 +515,7 @@ Record_ass_sub(Record *self, PyObject *key, PyObject *v)
return Record_ass_item(self, i, v); return Record_ass_item(self, i, v);
} }
if(io=PyObject_GetItem(self->schema, key)) if((io=PyObject_GetItem(self->schema, key)))
{ {
UNLESS(PyInt_Check(io)) UNLESS(PyInt_Check(io))
{ {
...@@ -592,7 +593,7 @@ void ...@@ -592,7 +593,7 @@ void
initRecord() initRecord()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.9 $"; char *rev="$Revision: 1.10 $";
UNLESS(py___record_schema__=PyString_FromString("__record_schema__")) return; UNLESS(py___record_schema__=PyString_FromString("__record_schema__")) return;
...@@ -631,6 +632,10 @@ initRecord() ...@@ -631,6 +632,10 @@ initRecord()
Revision Log: Revision Log:
$Log: Record.c,v $ $Log: Record.c,v $
Revision 1.10 2001/02/19 19:16:07 jeremy
silence compiler warnings
(2 remain)
Revision 1.9 2000/04/21 14:17:23 tseaver Revision 1.9 2000/04/21 14:17:23 tseaver
Collector #1012: Guarantee null-terminated buffer in Record_init() so Record_compare doesn't UMR Collector #1012: Guarantee null-terminated buffer in Record_init() so Record_compare doesn't UMR
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment