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

silence compiler warnings

(2 remain)
parent 1affceb7
......@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
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,
contact:
......@@ -118,11 +118,11 @@ CallMethodO(PyObject *self, PyObject *name,
{
if (! args && PyErr_Occurred()) return NULL;
UNLESS(name=PyObject_GetAttr(self,name)) {
if (args) Py_DECREF(args);
if (args) { Py_DECREF(args); }
return NULL;
}
ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw));
if (args) Py_DECREF(args);
if (args) { Py_DECREF(args); }
return name;
}
......@@ -298,7 +298,7 @@ Wrapper_special(Wrapper *self, char *name, PyObject *oname)
case 'c':
if (strcmp(name,"chain")==0)
{
if (r=PyList_New(0))
if ((r = PyList_New(0)))
while (1)
{
if (PyList_Append(r,OBJECT(self)) >= 0)
......@@ -398,7 +398,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
if (PyString_Check(oname)) name=PyString_AS_STRING(oname);
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)
switch(apply_filter(filter,OBJECT(self),oname,r,extra,orig))
......@@ -425,7 +425,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
{
if (isWrapper(self->obj))
{
if (r=Wrapper_findattr(WRAPPER(self->obj),
if ((r=Wrapper_findattr(WRAPPER(self->obj),
oname, filter, extra, orig, 1,
/* Search object container if explicit,
......@@ -433,8 +433,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
explicit ||
self->obj->ob_type ==
(PyTypeObject*)&Wrappertype,
explicit, containment))
explicit, containment)))
{
if (PyECMethod_Check(r) && PyECMethod_Self(r)==self->obj)
ASSIGN(r,PyECMethod_New(r,OBJECT(self)));
......@@ -525,12 +524,12 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
}
else
{
if ((r=PyObject_GetAttr(self->container,oname)))
if ((r=PyObject_GetAttr(self->container,oname))) {
if (r == Acquired)
{
Py_DECREF(r);
}
else
else {
if (filter)
switch(apply_filter(filter,self->container,oname,r,
extra,orig))
......@@ -546,6 +545,8 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
if (has__of__(r)) ASSIGN(r,__of__(r,OBJECT(self)));
return r;
}
}
}
}
}
......@@ -566,7 +567,6 @@ Wrapper_getattro(Wrapper *self, PyObject *oname)
static PyObject *
Xaq_getattro(Wrapper *self, PyObject *oname)
{
PyObject *r, *v, *tb;
char *name="";
/* Special case backward-compatible acquire method. */
......@@ -1425,7 +1425,7 @@ void
initAcquisition()
{
PyObject *m, *d;
char *rev="$Revision: 1.46 $";
char *rev="$Revision: 1.47 $";
PURE_MIXIN_CLASS(Acquirer,
"Base class for objects that implicitly"
" acquire attributes from containers\n"
......@@ -1444,7 +1444,7 @@ initAcquisition()
/* Create the module and add the functions */
m = Py_InitModule4("Acquisition", methods,
"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);
d = PyModule_GetDict(m);
......
......@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
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,
contact:
......@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n"
" - They can be called to create instances.\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>
......@@ -184,7 +184,7 @@ CallMethodO(PyObject *self, PyObject *name,
if (! args && PyErr_Occurred()) return NULL;
UNLESS(name=PyObject_GetAttr(self,name)) return NULL;
ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw));
if (args) Py_DECREF(args);
if (args) { Py_DECREF(args); }
return name;
}
......@@ -607,11 +607,12 @@ CMethod_getattro(CMethod *self, PyObject *oname)
{
ASSIGN(r, PyObject_GetAttr(r, oname));
if (r)
if (r) {
if (UnboundCMethod_Check(r))
ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self));
else if (UnboundPMethod_Check(r))
ASSIGN(r, bindPMethod((PMethod*)r, self->self));
}
}
Py_DECREF(oname);
return r;
......@@ -921,11 +922,12 @@ PMethod_getattro(PMethod *self, PyObject *oname)
{
ASSIGN(r, PyObject_GetAttr(r, oname));
if (r)
if (r) {
if (UnboundCMethod_Check(r))
ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self));
else if (UnboundPMethod_Check(r))
ASSIGN(r, bindPMethod((PMethod*)r, self->self));
}
}
Py_DECREF(oname);
return r;
......@@ -1080,7 +1082,6 @@ static PyObject *
delsetattr_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type)
{
char *name;
PyObject *v;
UNLESS(PyArg_ParseTuple(args,"s",&name)) return NULL;
UNLESS(-1 != ob_type->tp_setattr(self,name,NULL)) return NULL;
Py_INCREF(Py_None);
......@@ -1110,7 +1111,6 @@ static PyObject *
delsetattro_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type)
{
PyObject *name;
PyObject *v;
UNLESS(PyArg_ParseTuple(args,"O",&name)) return NULL;
UNLESS(-1 != ob_type->tp_setattro(self,name,NULL)) return NULL;
Py_INCREF(Py_None);
......@@ -1661,7 +1661,9 @@ CCL_dealloc(PyExtensionClass *self)
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);
}
......@@ -3066,7 +3068,9 @@ subclass_dealloc(PyObject *self)
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.
If there was, then it deallocates the object and we
......@@ -3340,8 +3344,6 @@ subclass__init__(PyExtensionClass *self, PyObject *args)
That means that we simply copy the base class
get/setattr.
*/
PyObject *r;
copy_member(tp_getattr);
copy_member(tp_getattro);
copy_member(tp_setattr);
......@@ -3528,7 +3530,7 @@ void
initExtensionClass()
{
PyObject *m, *d;
char *rev="$Revision: 1.43 $";
char *rev="$Revision: 1.44 $";
PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL);
PMethodType.ob_type=&PyType_Type;
......
......@@ -84,7 +84,7 @@
****************************************************************************/
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
......@@ -151,7 +151,7 @@ Record___setstate__(Record *self, PyObject *args)
UNLESS(PyArg_ParseTuple(args, "|OO", &state, &parent)) return NULL;
if(state)
if(state) {
if(PyDict_Check(state))
{
PyObject *k, *v;
......@@ -170,6 +170,7 @@ Record___setstate__(Record *self, PyObject *args)
UNLESS(*d) return NULL;
}
}
}
Py_INCREF(Py_None);
return Py_None;
......@@ -262,11 +263,11 @@ Record_getattr(Record *self, PyObject *name)
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();
if(io=PyObject_GetItem(self->schema, name))
if((io=PyObject_GetItem(self->schema, name)))
{
UNLESS(PyInt_Check(io))
{
......@@ -296,7 +297,7 @@ Record_setattr(Record *self, PyObject *name, PyObject *v)
PyObject *io;
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))
{
......@@ -350,7 +351,7 @@ Record_compare(Record *v, Record *w)
if(*dv)
if(*dw)
{
if(c=PyObject_Compare(*dv,*dw)) return c;
if((c=PyObject_Compare(*dv,*dw))) return c;
}
else return 1;
else if(*dw) return -1;
......@@ -474,7 +475,7 @@ Record_subscript(Record *self, PyObject *key)
return Record_item(self, i);
}
if(io=PyObject_GetItem(self->schema, key))
if((io=PyObject_GetItem(self->schema, key)))
{
UNLESS(PyInt_Check(io))
{
......@@ -493,7 +494,7 @@ Record_subscript(Record *self, PyObject *key)
}
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);
return NULL;
......@@ -514,7 +515,7 @@ Record_ass_sub(Record *self, PyObject *key, PyObject *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))
{
......@@ -592,7 +593,7 @@ void
initRecord()
{
PyObject *m, *d;
char *rev="$Revision: 1.9 $";
char *rev="$Revision: 1.10 $";
UNLESS(py___record_schema__=PyString_FromString("__record_schema__")) return;
......@@ -631,6 +632,10 @@ initRecord()
Revision Log:
$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
Collector #1012: Guarantee null-terminated buffer in Record_init() so Record_compare doesn't UMR
......
......@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
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,
contact:
......@@ -118,11 +118,11 @@ CallMethodO(PyObject *self, PyObject *name,
{
if (! args && PyErr_Occurred()) return NULL;
UNLESS(name=PyObject_GetAttr(self,name)) {
if (args) Py_DECREF(args);
if (args) { Py_DECREF(args); }
return NULL;
}
ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw));
if (args) Py_DECREF(args);
if (args) { Py_DECREF(args); }
return name;
}
......@@ -298,7 +298,7 @@ Wrapper_special(Wrapper *self, char *name, PyObject *oname)
case 'c':
if (strcmp(name,"chain")==0)
{
if (r=PyList_New(0))
if ((r = PyList_New(0)))
while (1)
{
if (PyList_Append(r,OBJECT(self)) >= 0)
......@@ -398,7 +398,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
if (PyString_Check(oname)) name=PyString_AS_STRING(oname);
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)
switch(apply_filter(filter,OBJECT(self),oname,r,extra,orig))
......@@ -425,7 +425,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
{
if (isWrapper(self->obj))
{
if (r=Wrapper_findattr(WRAPPER(self->obj),
if ((r=Wrapper_findattr(WRAPPER(self->obj),
oname, filter, extra, orig, 1,
/* Search object container if explicit,
......@@ -433,8 +433,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
explicit ||
self->obj->ob_type ==
(PyTypeObject*)&Wrappertype,
explicit, containment))
explicit, containment)))
{
if (PyECMethod_Check(r) && PyECMethod_Self(r)==self->obj)
ASSIGN(r,PyECMethod_New(r,OBJECT(self)));
......@@ -525,12 +524,12 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
}
else
{
if ((r=PyObject_GetAttr(self->container,oname)))
if ((r=PyObject_GetAttr(self->container,oname))) {
if (r == Acquired)
{
Py_DECREF(r);
}
else
else {
if (filter)
switch(apply_filter(filter,self->container,oname,r,
extra,orig))
......@@ -546,6 +545,8 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
if (has__of__(r)) ASSIGN(r,__of__(r,OBJECT(self)));
return r;
}
}
}
}
}
......@@ -566,7 +567,6 @@ Wrapper_getattro(Wrapper *self, PyObject *oname)
static PyObject *
Xaq_getattro(Wrapper *self, PyObject *oname)
{
PyObject *r, *v, *tb;
char *name="";
/* Special case backward-compatible acquire method. */
......@@ -1425,7 +1425,7 @@ void
initAcquisition()
{
PyObject *m, *d;
char *rev="$Revision: 1.46 $";
char *rev="$Revision: 1.47 $";
PURE_MIXIN_CLASS(Acquirer,
"Base class for objects that implicitly"
" acquire attributes from containers\n"
......@@ -1444,7 +1444,7 @@ initAcquisition()
/* Create the module and add the functions */
m = Py_InitModule4("Acquisition", methods,
"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);
d = PyModule_GetDict(m);
......
......@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
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,
contact:
......@@ -54,7 +54,7 @@ static char ExtensionClass_module_documentation[] =
" - They provide access to unbound methods,\n"
" - They can be called to create instances.\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>
......@@ -184,7 +184,7 @@ CallMethodO(PyObject *self, PyObject *name,
if (! args && PyErr_Occurred()) return NULL;
UNLESS(name=PyObject_GetAttr(self,name)) return NULL;
ASSIGN(name,PyEval_CallObjectWithKeywords(name,args,kw));
if (args) Py_DECREF(args);
if (args) { Py_DECREF(args); }
return name;
}
......@@ -607,11 +607,12 @@ CMethod_getattro(CMethod *self, PyObject *oname)
{
ASSIGN(r, PyObject_GetAttr(r, oname));
if (r)
if (r) {
if (UnboundCMethod_Check(r))
ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self));
else if (UnboundPMethod_Check(r))
ASSIGN(r, bindPMethod((PMethod*)r, self->self));
}
}
Py_DECREF(oname);
return r;
......@@ -921,11 +922,12 @@ PMethod_getattro(PMethod *self, PyObject *oname)
{
ASSIGN(r, PyObject_GetAttr(r, oname));
if (r)
if (r) {
if (UnboundCMethod_Check(r))
ASSIGN(r, (PyObject*)bindCMethod((CMethod*)r, self->self));
else if (UnboundPMethod_Check(r))
ASSIGN(r, bindPMethod((PMethod*)r, self->self));
}
}
Py_DECREF(oname);
return r;
......@@ -1080,7 +1082,6 @@ static PyObject *
delsetattr_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type)
{
char *name;
PyObject *v;
UNLESS(PyArg_ParseTuple(args,"s",&name)) return NULL;
UNLESS(-1 != ob_type->tp_setattr(self,name,NULL)) return NULL;
Py_INCREF(Py_None);
......@@ -1110,7 +1111,6 @@ static PyObject *
delsetattro_by_name(PyObject *self, PyObject *args, PyTypeObject *ob_type)
{
PyObject *name;
PyObject *v;
UNLESS(PyArg_ParseTuple(args,"O",&name)) return NULL;
UNLESS(-1 != ob_type->tp_setattro(self,name,NULL)) return NULL;
Py_INCREF(Py_None);
......@@ -1661,7 +1661,9 @@ CCL_dealloc(PyExtensionClass *self)
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);
}
......@@ -3066,7 +3068,9 @@ subclass_dealloc(PyObject *self)
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.
If there was, then it deallocates the object and we
......@@ -3340,8 +3344,6 @@ subclass__init__(PyExtensionClass *self, PyObject *args)
That means that we simply copy the base class
get/setattr.
*/
PyObject *r;
copy_member(tp_getattr);
copy_member(tp_getattro);
copy_member(tp_setattr);
......@@ -3528,7 +3530,7 @@ void
initExtensionClass()
{
PyObject *m, *d;
char *rev="$Revision: 1.43 $";
char *rev="$Revision: 1.44 $";
PURE_MIXIN_CLASS(Base, "Minimalbase class for Extension Classes", NULL);
PMethodType.ob_type=&PyType_Type;
......
......@@ -84,7 +84,7 @@
****************************************************************************/
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
......@@ -151,7 +151,7 @@ Record___setstate__(Record *self, PyObject *args)
UNLESS(PyArg_ParseTuple(args, "|OO", &state, &parent)) return NULL;
if(state)
if(state) {
if(PyDict_Check(state))
{
PyObject *k, *v;
......@@ -170,6 +170,7 @@ Record___setstate__(Record *self, PyObject *args)
UNLESS(*d) return NULL;
}
}
}
Py_INCREF(Py_None);
return Py_None;
......@@ -262,11 +263,11 @@ Record_getattr(Record *self, PyObject *name)
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();
if(io=PyObject_GetItem(self->schema, name))
if((io=PyObject_GetItem(self->schema, name)))
{
UNLESS(PyInt_Check(io))
{
......@@ -296,7 +297,7 @@ Record_setattr(Record *self, PyObject *name, PyObject *v)
PyObject *io;
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))
{
......@@ -350,7 +351,7 @@ Record_compare(Record *v, Record *w)
if(*dv)
if(*dw)
{
if(c=PyObject_Compare(*dv,*dw)) return c;
if((c=PyObject_Compare(*dv,*dw))) return c;
}
else return 1;
else if(*dw) return -1;
......@@ -474,7 +475,7 @@ Record_subscript(Record *self, PyObject *key)
return Record_item(self, i);
}
if(io=PyObject_GetItem(self->schema, key))
if((io=PyObject_GetItem(self->schema, key)))
{
UNLESS(PyInt_Check(io))
{
......@@ -493,7 +494,7 @@ Record_subscript(Record *self, PyObject *key)
}
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);
return NULL;
......@@ -514,7 +515,7 @@ Record_ass_sub(Record *self, PyObject *key, PyObject *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))
{
......@@ -592,7 +593,7 @@ void
initRecord()
{
PyObject *m, *d;
char *rev="$Revision: 1.9 $";
char *rev="$Revision: 1.10 $";
UNLESS(py___record_schema__=PyString_FromString("__record_schema__")) return;
......@@ -631,6 +632,10 @@ initRecord()
Revision Log:
$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
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