Commit b9292760 authored by Jim Fulton's avatar Jim Fulton

Added stupid parens and other changes to make 'gcc -Wall -pedantic'

and Barry happy.  Got rid of some extra variable declarations.
parent 07f0adec
/* /*
$Id: ExtensionClass.c,v 1.13 1997/07/02 17:33:39 jim Exp $ $Id: ExtensionClass.c,v 1.14 1997/07/02 20:17:15 jim Exp $
Extension Class Extension Class
...@@ -65,7 +65,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -65,7 +65,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.13 1997/07/02 17:33:39 jim Exp $\n" "$Id: ExtensionClass.c,v 1.14 1997/07/02 20:17:15 jim Exp $\n"
; ;
#include <stdio.h> #include <stdio.h>
...@@ -436,7 +436,7 @@ callCMethodWithHook(CMethod *self, PyObject *inst, ...@@ -436,7 +436,7 @@ callCMethodWithHook(CMethod *self, PyObject *inst,
inst, self->name, self->meth, inst, self->name, self->meth,
self->flags, hook_mark)) return NULL; self->flags, hook_mark)) return NULL;
if(hook=PyObject_GetAttr(inst,py__call_method__)) if((hook=PyObject_GetAttr(inst,py__call_method__)))
{ {
if(CMethod_Check(hook) && ((CMethod*)hook)->meth==self->meth) if(CMethod_Check(hook) && ((CMethod*)hook)->meth==self->meth)
{ {
...@@ -629,7 +629,7 @@ PMethod_New(PyObject *meth, PyObject *inst) ...@@ -629,7 +629,7 @@ PMethod_New(PyObject *meth, PyObject *inst)
"Attempt to use %s as method for %s, which is " "Attempt to use %s as method for %s, which is "
"not an extension class instance.", "not an extension class instance.",
"OO",meth,inst); "OO",meth,inst);
if(meth=newPMethod(ExtensionClassOf(inst), meth)) if((meth=newPMethod(ExtensionClassOf(inst), meth)))
UNLESS_ASSIGN(((PMethod*)meth)->self,inst) return NULL; UNLESS_ASSIGN(((PMethod*)meth)->self,inst) return NULL;
Py_INCREF(inst); Py_INCREF(inst);
return meth; return meth;
...@@ -656,7 +656,7 @@ callMethodWithPossibleHook(PyObject *inst, ...@@ -656,7 +656,7 @@ callMethodWithPossibleHook(PyObject *inst,
if(HasMethodHook(inst)) if(HasMethodHook(inst))
{ {
PyObject *hook; PyObject *hook;
if(hook=PyObject_GetAttr(inst,py__call_method__)) if((hook=PyObject_GetAttr(inst,py__call_method__)))
{ {
if(PMethod_Check(hook) && ((PMethod*)hook)->meth==meth) if(PMethod_Check(hook) && ((PMethod*)hook)->meth==meth)
{ {
...@@ -1069,7 +1069,7 @@ getBaseDictionary(PyExtensionClass *type) ...@@ -1069,7 +1069,7 @@ getBaseDictionary(PyExtensionClass *type)
FILLENTRY(type->tp, getattro, getattr, METH_VARARGS, "Get an attribute"); FILLENTRY(type->tp, getattro, getattr, METH_VARARGS, "Get an attribute");
FILLENTRY(type->tp, setattro, setattr, METH_VARARGS, "Set an attribute"); FILLENTRY(type->tp, setattro, setattr, METH_VARARGS, "Set an attribute");
if(sm=type->tp_as_sequence) if((sm=type->tp_as_sequence))
{ {
FILLENTRY(sm->sq, length, len, METH_VARARGS, "Get the object length"); FILLENTRY(sm->sq, length, len, METH_VARARGS, "Get the object length");
FILLENTRY(sm->sq, repeat, mul, METH_VARARGS, FILLENTRY(sm->sq, repeat, mul, METH_VARARGS,
...@@ -1080,7 +1080,7 @@ getBaseDictionary(PyExtensionClass *type) ...@@ -1080,7 +1080,7 @@ getBaseDictionary(PyExtensionClass *type)
FILLENTRY(sm->sq, ass_slice, setslice, METH_VARARGS, "Assign a slice"); FILLENTRY(sm->sq, ass_slice, setslice, METH_VARARGS, "Assign a slice");
} }
if(mm=type->tp_as_mapping) if((mm=type->tp_as_mapping))
{ {
FILLENTRY(mm->mp, length, len, METH_VARARGS, "Get the object length"); FILLENTRY(mm->mp, length, len, METH_VARARGS, "Get the object length");
FILLENTRY(mm->mp, subscript, getitem, METH_VARARGS, "Get an item"); FILLENTRY(mm->mp, subscript, getitem, METH_VARARGS, "Get an item");
...@@ -1123,7 +1123,7 @@ getBaseDictionary(PyExtensionClass *type) ...@@ -1123,7 +1123,7 @@ getBaseDictionary(PyExtensionClass *type)
"Convert to a hexadecimal string"); "Convert to a hexadecimal string");
} }
if(sm=type->tp_as_sequence) if((sm=type->tp_as_sequence))
{ {
FILLENTRY(sm->sq, concat, add, METH_VARARGS, FILLENTRY(sm->sq, concat, add, METH_VARARGS,
"Concatinate the object with another"); "Concatinate the object with another");
...@@ -1145,7 +1145,7 @@ EC_reduce(PyObject *self, PyObject *args) ...@@ -1145,7 +1145,7 @@ EC_reduce(PyObject *self, PyObject *args)
{ {
PyObject *state=0; PyObject *state=0;
if(args=PyObject_GetAttr(self,py__getinitargs__)) if((args=PyObject_GetAttr(self,py__getinitargs__)))
{ {
UNLESS_ASSIGN(args,PyEval_CallObject(args,NULL)) return NULL; UNLESS_ASSIGN(args,PyEval_CallObject(args,NULL)) return NULL;
UNLESS_ASSIGN(args,PySequence_Tuple(args)) return NULL; UNLESS_ASSIGN(args,PySequence_Tuple(args)) return NULL;
...@@ -1156,7 +1156,7 @@ EC_reduce(PyObject *self, PyObject *args) ...@@ -1156,7 +1156,7 @@ EC_reduce(PyObject *self, PyObject *args)
args=PyTuple_New(0); args=PyTuple_New(0);
} }
if(state=PyObject_GetAttr(self,py__getstate__)) if((state=PyObject_GetAttr(self,py__getstate__)))
{ {
UNLESS_ASSIGN(state,PyEval_CallObject(state,NULL)) goto err; UNLESS_ASSIGN(state,PyEval_CallObject(state,NULL)) goto err;
ASSIGN(args,Py_BuildValue("OOO", self->ob_type, args, state)); ASSIGN(args,Py_BuildValue("OOO", self->ob_type, args, state));
...@@ -1166,7 +1166,7 @@ EC_reduce(PyObject *self, PyObject *args) ...@@ -1166,7 +1166,7 @@ EC_reduce(PyObject *self, PyObject *args)
{ {
PyErr_Clear(); PyErr_Clear();
if(state=PyObject_GetAttr(self, py__dict__)) if((state=PyObject_GetAttr(self, py__dict__)))
{ {
ASSIGN(args,Py_BuildValue("OOO", self->ob_type, args, state)); ASSIGN(args,Py_BuildValue("OOO", self->ob_type, args, state));
Py_DECREF(state); Py_DECREF(state);
...@@ -1284,7 +1284,7 @@ initializeBaseExtensionClass(PyExtensionClass *self) ...@@ -1284,7 +1284,7 @@ initializeBaseExtensionClass(PyExtensionClass *self)
onto a special method. */ onto a special method. */
PyObject *m; PyObject *m;
if(m=PyMapping_GetItemString(dict,ml->ml_name)) if((m=PyMapping_GetItemString(dict,ml->ml_name)))
{ {
if(m->ob_type==&CMethodType) if(m->ob_type==&CMethodType)
((CMethod *)(m))->doc=ml->ml_doc; ((CMethod *)(m))->doc=ml->ml_doc;
...@@ -1529,7 +1529,7 @@ CCL_getattro(PyExtensionClass *self, PyObject *name) ...@@ -1529,7 +1529,7 @@ CCL_getattro(PyExtensionClass *self, PyObject *name)
"look up an attribute in a class's super classes"); "look up an attribute in a class's super classes");
} }
if(r=CCL_getattr(self,name,0)) return r; if((r=CCL_getattr(self,name,0))) return r;
return NULL; return NULL;
} }
...@@ -1677,7 +1677,7 @@ CCL_call(PyExtensionClass *self, PyObject *arg, PyObject *kw) ...@@ -1677,7 +1677,7 @@ CCL_call(PyExtensionClass *self, PyObject *arg, PyObject *kw)
PyObject *var_size; PyObject *var_size;
int size; int size;
if(var_size=CCL_getattr(self,py__var_size__, 0)) if((var_size=CCL_getattr(self,py__var_size__, 0)))
{ {
UNLESS_ASSIGN(var_size,PyObject_CallObject(var_size,arg)) UNLESS_ASSIGN(var_size,PyObject_CallObject(var_size,arg))
return NULL; return NULL;
...@@ -1722,7 +1722,7 @@ CCL_call(PyExtensionClass *self, PyObject *arg, PyObject *kw) ...@@ -1722,7 +1722,7 @@ CCL_call(PyExtensionClass *self, PyObject *arg, PyObject *kw)
if(ClassHasInstDict(self)) if(ClassHasInstDict(self))
UNLESS(INSTANCE_DICT(inst)=PyDict_New()) goto err; UNLESS(INSTANCE_DICT(inst)=PyDict_New()) goto err;
if(init=CCL_getattr(self,py__init__,0)) if((init=CCL_getattr(self,py__init__,0)))
{ {
UNLESS(args=Py_BuildValue("(O)",inst)) goto err; UNLESS(args=Py_BuildValue("(O)",inst)) goto err;
if(arg) UNLESS_ASSIGN(args,PySequence_Concat(args,arg)) goto err; if(arg) UNLESS_ASSIGN(args,PySequence_Concat(args,arg)) goto err;
...@@ -2594,7 +2594,7 @@ subclass_dealloc(PyObject *self) ...@@ -2594,7 +2594,7 @@ subclass_dealloc(PyObject *self)
PyErr_Clear(); PyErr_Clear();
if(m=subclass_getspecial(self,py__del__)) if((m=subclass_getspecial(self,py__del__)))
{ {
if(UnboundEMethod_Check(m)) if(UnboundEMethod_Check(m))
ASSIGN(m,PyObject_CallFunction(m,"O",self)); ASSIGN(m,PyObject_CallFunction(m,"O",self));
...@@ -2626,7 +2626,7 @@ datafull_baseclassesf(PyExtensionClass *type, PyObject **c1, PyObject **c2) ...@@ -2626,7 +2626,7 @@ datafull_baseclassesf(PyExtensionClass *type, PyObject **c1, PyObject **c2)
/* Find the number of classes that have data and return them. /* Find the number of classes that have data and return them.
There should be no more than one. There should be no more than one.
*/ */
int l, i, n=0; int l, i;
PyObject *base; PyObject *base;
l=PyTuple_Size(type->bases); l=PyTuple_Size(type->bases);
...@@ -2667,7 +2667,7 @@ static PyObject * ...@@ -2667,7 +2667,7 @@ static PyObject *
datafull_baseclass(PyExtensionClass *type) datafull_baseclass(PyExtensionClass *type)
{ {
/* Find the baseclass that has data and. There should be only one. */ /* Find the baseclass that has data and. There should be only one. */
int l, i, n=0; int l, i;
PyObject *base, *dbase; PyObject *base, *dbase;
l=PyTuple_Size(type->bases); l=PyTuple_Size(type->bases);
...@@ -2678,7 +2678,7 @@ datafull_baseclass(PyExtensionClass *type) ...@@ -2678,7 +2678,7 @@ datafull_baseclass(PyExtensionClass *type)
{ {
if(AsExtensionClass(base)->bases) if(AsExtensionClass(base)->bases)
{ {
if(dbase=datafull_baseclass(AsExtensionClass(base))) if((dbase=datafull_baseclass(AsExtensionClass(base))))
return dbase; return dbase;
} }
else else
...@@ -2697,7 +2697,7 @@ static PyObject * ...@@ -2697,7 +2697,7 @@ static PyObject *
extension_baseclass(PyExtensionClass *type) extension_baseclass(PyExtensionClass *type)
{ {
/* Find the first immediate base class that is an extension class */ /* Find the first immediate base class that is an extension class */
int l, i, n=0; int l, i;
PyObject *base; PyObject *base;
l=PyTuple_Size(type->bases); l=PyTuple_Size(type->bases);
...@@ -2715,7 +2715,7 @@ subclass_hasattr(PyExtensionClass *type, PyObject *name) ...@@ -2715,7 +2715,7 @@ subclass_hasattr(PyExtensionClass *type, PyObject *name)
{ {
PyObject *o; PyObject *o;
if(o=CCL_getattro(type,name)) if((o=CCL_getattro(type,name)))
{ {
Py_DECREF(o); Py_DECREF(o);
return 1; return 1;
...@@ -2910,7 +2910,7 @@ subclass__init__(PyExtensionClass *self, PyObject *args) ...@@ -2910,7 +2910,7 @@ subclass__init__(PyExtensionClass *self, PyObject *args)
self->tp_doc=0; self->tp_doc=0;
/* Check for and use __class_init__ */ /* Check for and use __class_init__ */
if(class_init=PyObject_GetAttrString(AsPyObject(self),"__class_init__")) if((class_init=PyObject_GetAttrString(AsPyObject(self),"__class_init__")))
{ {
UNLESS_ASSIGN(class_init,PyObject_GetAttrString(class_init,"im_func")) UNLESS_ASSIGN(class_init,PyObject_GetAttrString(class_init,"im_func"))
return NULL; return NULL;
...@@ -3005,7 +3005,7 @@ void ...@@ -3005,7 +3005,7 @@ void
initExtensionClass() initExtensionClass()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.13 $"; char *rev="$Revision: 1.14 $";
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;
...@@ -3023,6 +3023,8 @@ initExtensionClass() ...@@ -3023,6 +3023,8 @@ initExtensionClass()
init_py_names(); init_py_names();
if(0) PyCObject_Import14("this will go away", "in 1.5 :-)");
initializeBaseExtensionClass(&ECType); initializeBaseExtensionClass(&ECType);
PyDict_SetItemString(d, "ExtensionClass", (PyObject*)&ECType); PyDict_SetItemString(d, "ExtensionClass", (PyObject*)&ECType);
...@@ -3042,6 +3044,10 @@ initExtensionClass() ...@@ -3042,6 +3044,10 @@ initExtensionClass()
/**************************************************************************** /****************************************************************************
$Log: ExtensionClass.c,v $ $Log: ExtensionClass.c,v $
Revision 1.14 1997/07/02 20:17:15 jim
Added stupid parens and other changes to make 'gcc -Wall -pedantic'
and Barry happy. Got rid of some extra variable declarations.
Revision 1.13 1997/07/02 17:33:39 jim Revision 1.13 1997/07/02 17:33:39 jim
Included my version of PyErr_Format. Included my version of PyErr_Format.
......
/* /*
$Id: ExtensionClass.c,v 1.13 1997/07/02 17:33:39 jim Exp $ $Id: ExtensionClass.c,v 1.14 1997/07/02 20:17:15 jim Exp $
Extension Class Extension Class
...@@ -65,7 +65,7 @@ static char ExtensionClass_module_documentation[] = ...@@ -65,7 +65,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.13 1997/07/02 17:33:39 jim Exp $\n" "$Id: ExtensionClass.c,v 1.14 1997/07/02 20:17:15 jim Exp $\n"
; ;
#include <stdio.h> #include <stdio.h>
...@@ -436,7 +436,7 @@ callCMethodWithHook(CMethod *self, PyObject *inst, ...@@ -436,7 +436,7 @@ callCMethodWithHook(CMethod *self, PyObject *inst,
inst, self->name, self->meth, inst, self->name, self->meth,
self->flags, hook_mark)) return NULL; self->flags, hook_mark)) return NULL;
if(hook=PyObject_GetAttr(inst,py__call_method__)) if((hook=PyObject_GetAttr(inst,py__call_method__)))
{ {
if(CMethod_Check(hook) && ((CMethod*)hook)->meth==self->meth) if(CMethod_Check(hook) && ((CMethod*)hook)->meth==self->meth)
{ {
...@@ -629,7 +629,7 @@ PMethod_New(PyObject *meth, PyObject *inst) ...@@ -629,7 +629,7 @@ PMethod_New(PyObject *meth, PyObject *inst)
"Attempt to use %s as method for %s, which is " "Attempt to use %s as method for %s, which is "
"not an extension class instance.", "not an extension class instance.",
"OO",meth,inst); "OO",meth,inst);
if(meth=newPMethod(ExtensionClassOf(inst), meth)) if((meth=newPMethod(ExtensionClassOf(inst), meth)))
UNLESS_ASSIGN(((PMethod*)meth)->self,inst) return NULL; UNLESS_ASSIGN(((PMethod*)meth)->self,inst) return NULL;
Py_INCREF(inst); Py_INCREF(inst);
return meth; return meth;
...@@ -656,7 +656,7 @@ callMethodWithPossibleHook(PyObject *inst, ...@@ -656,7 +656,7 @@ callMethodWithPossibleHook(PyObject *inst,
if(HasMethodHook(inst)) if(HasMethodHook(inst))
{ {
PyObject *hook; PyObject *hook;
if(hook=PyObject_GetAttr(inst,py__call_method__)) if((hook=PyObject_GetAttr(inst,py__call_method__)))
{ {
if(PMethod_Check(hook) && ((PMethod*)hook)->meth==meth) if(PMethod_Check(hook) && ((PMethod*)hook)->meth==meth)
{ {
...@@ -1069,7 +1069,7 @@ getBaseDictionary(PyExtensionClass *type) ...@@ -1069,7 +1069,7 @@ getBaseDictionary(PyExtensionClass *type)
FILLENTRY(type->tp, getattro, getattr, METH_VARARGS, "Get an attribute"); FILLENTRY(type->tp, getattro, getattr, METH_VARARGS, "Get an attribute");
FILLENTRY(type->tp, setattro, setattr, METH_VARARGS, "Set an attribute"); FILLENTRY(type->tp, setattro, setattr, METH_VARARGS, "Set an attribute");
if(sm=type->tp_as_sequence) if((sm=type->tp_as_sequence))
{ {
FILLENTRY(sm->sq, length, len, METH_VARARGS, "Get the object length"); FILLENTRY(sm->sq, length, len, METH_VARARGS, "Get the object length");
FILLENTRY(sm->sq, repeat, mul, METH_VARARGS, FILLENTRY(sm->sq, repeat, mul, METH_VARARGS,
...@@ -1080,7 +1080,7 @@ getBaseDictionary(PyExtensionClass *type) ...@@ -1080,7 +1080,7 @@ getBaseDictionary(PyExtensionClass *type)
FILLENTRY(sm->sq, ass_slice, setslice, METH_VARARGS, "Assign a slice"); FILLENTRY(sm->sq, ass_slice, setslice, METH_VARARGS, "Assign a slice");
} }
if(mm=type->tp_as_mapping) if((mm=type->tp_as_mapping))
{ {
FILLENTRY(mm->mp, length, len, METH_VARARGS, "Get the object length"); FILLENTRY(mm->mp, length, len, METH_VARARGS, "Get the object length");
FILLENTRY(mm->mp, subscript, getitem, METH_VARARGS, "Get an item"); FILLENTRY(mm->mp, subscript, getitem, METH_VARARGS, "Get an item");
...@@ -1123,7 +1123,7 @@ getBaseDictionary(PyExtensionClass *type) ...@@ -1123,7 +1123,7 @@ getBaseDictionary(PyExtensionClass *type)
"Convert to a hexadecimal string"); "Convert to a hexadecimal string");
} }
if(sm=type->tp_as_sequence) if((sm=type->tp_as_sequence))
{ {
FILLENTRY(sm->sq, concat, add, METH_VARARGS, FILLENTRY(sm->sq, concat, add, METH_VARARGS,
"Concatinate the object with another"); "Concatinate the object with another");
...@@ -1145,7 +1145,7 @@ EC_reduce(PyObject *self, PyObject *args) ...@@ -1145,7 +1145,7 @@ EC_reduce(PyObject *self, PyObject *args)
{ {
PyObject *state=0; PyObject *state=0;
if(args=PyObject_GetAttr(self,py__getinitargs__)) if((args=PyObject_GetAttr(self,py__getinitargs__)))
{ {
UNLESS_ASSIGN(args,PyEval_CallObject(args,NULL)) return NULL; UNLESS_ASSIGN(args,PyEval_CallObject(args,NULL)) return NULL;
UNLESS_ASSIGN(args,PySequence_Tuple(args)) return NULL; UNLESS_ASSIGN(args,PySequence_Tuple(args)) return NULL;
...@@ -1156,7 +1156,7 @@ EC_reduce(PyObject *self, PyObject *args) ...@@ -1156,7 +1156,7 @@ EC_reduce(PyObject *self, PyObject *args)
args=PyTuple_New(0); args=PyTuple_New(0);
} }
if(state=PyObject_GetAttr(self,py__getstate__)) if((state=PyObject_GetAttr(self,py__getstate__)))
{ {
UNLESS_ASSIGN(state,PyEval_CallObject(state,NULL)) goto err; UNLESS_ASSIGN(state,PyEval_CallObject(state,NULL)) goto err;
ASSIGN(args,Py_BuildValue("OOO", self->ob_type, args, state)); ASSIGN(args,Py_BuildValue("OOO", self->ob_type, args, state));
...@@ -1166,7 +1166,7 @@ EC_reduce(PyObject *self, PyObject *args) ...@@ -1166,7 +1166,7 @@ EC_reduce(PyObject *self, PyObject *args)
{ {
PyErr_Clear(); PyErr_Clear();
if(state=PyObject_GetAttr(self, py__dict__)) if((state=PyObject_GetAttr(self, py__dict__)))
{ {
ASSIGN(args,Py_BuildValue("OOO", self->ob_type, args, state)); ASSIGN(args,Py_BuildValue("OOO", self->ob_type, args, state));
Py_DECREF(state); Py_DECREF(state);
...@@ -1284,7 +1284,7 @@ initializeBaseExtensionClass(PyExtensionClass *self) ...@@ -1284,7 +1284,7 @@ initializeBaseExtensionClass(PyExtensionClass *self)
onto a special method. */ onto a special method. */
PyObject *m; PyObject *m;
if(m=PyMapping_GetItemString(dict,ml->ml_name)) if((m=PyMapping_GetItemString(dict,ml->ml_name)))
{ {
if(m->ob_type==&CMethodType) if(m->ob_type==&CMethodType)
((CMethod *)(m))->doc=ml->ml_doc; ((CMethod *)(m))->doc=ml->ml_doc;
...@@ -1529,7 +1529,7 @@ CCL_getattro(PyExtensionClass *self, PyObject *name) ...@@ -1529,7 +1529,7 @@ CCL_getattro(PyExtensionClass *self, PyObject *name)
"look up an attribute in a class's super classes"); "look up an attribute in a class's super classes");
} }
if(r=CCL_getattr(self,name,0)) return r; if((r=CCL_getattr(self,name,0))) return r;
return NULL; return NULL;
} }
...@@ -1677,7 +1677,7 @@ CCL_call(PyExtensionClass *self, PyObject *arg, PyObject *kw) ...@@ -1677,7 +1677,7 @@ CCL_call(PyExtensionClass *self, PyObject *arg, PyObject *kw)
PyObject *var_size; PyObject *var_size;
int size; int size;
if(var_size=CCL_getattr(self,py__var_size__, 0)) if((var_size=CCL_getattr(self,py__var_size__, 0)))
{ {
UNLESS_ASSIGN(var_size,PyObject_CallObject(var_size,arg)) UNLESS_ASSIGN(var_size,PyObject_CallObject(var_size,arg))
return NULL; return NULL;
...@@ -1722,7 +1722,7 @@ CCL_call(PyExtensionClass *self, PyObject *arg, PyObject *kw) ...@@ -1722,7 +1722,7 @@ CCL_call(PyExtensionClass *self, PyObject *arg, PyObject *kw)
if(ClassHasInstDict(self)) if(ClassHasInstDict(self))
UNLESS(INSTANCE_DICT(inst)=PyDict_New()) goto err; UNLESS(INSTANCE_DICT(inst)=PyDict_New()) goto err;
if(init=CCL_getattr(self,py__init__,0)) if((init=CCL_getattr(self,py__init__,0)))
{ {
UNLESS(args=Py_BuildValue("(O)",inst)) goto err; UNLESS(args=Py_BuildValue("(O)",inst)) goto err;
if(arg) UNLESS_ASSIGN(args,PySequence_Concat(args,arg)) goto err; if(arg) UNLESS_ASSIGN(args,PySequence_Concat(args,arg)) goto err;
...@@ -2594,7 +2594,7 @@ subclass_dealloc(PyObject *self) ...@@ -2594,7 +2594,7 @@ subclass_dealloc(PyObject *self)
PyErr_Clear(); PyErr_Clear();
if(m=subclass_getspecial(self,py__del__)) if((m=subclass_getspecial(self,py__del__)))
{ {
if(UnboundEMethod_Check(m)) if(UnboundEMethod_Check(m))
ASSIGN(m,PyObject_CallFunction(m,"O",self)); ASSIGN(m,PyObject_CallFunction(m,"O",self));
...@@ -2626,7 +2626,7 @@ datafull_baseclassesf(PyExtensionClass *type, PyObject **c1, PyObject **c2) ...@@ -2626,7 +2626,7 @@ datafull_baseclassesf(PyExtensionClass *type, PyObject **c1, PyObject **c2)
/* Find the number of classes that have data and return them. /* Find the number of classes that have data and return them.
There should be no more than one. There should be no more than one.
*/ */
int l, i, n=0; int l, i;
PyObject *base; PyObject *base;
l=PyTuple_Size(type->bases); l=PyTuple_Size(type->bases);
...@@ -2667,7 +2667,7 @@ static PyObject * ...@@ -2667,7 +2667,7 @@ static PyObject *
datafull_baseclass(PyExtensionClass *type) datafull_baseclass(PyExtensionClass *type)
{ {
/* Find the baseclass that has data and. There should be only one. */ /* Find the baseclass that has data and. There should be only one. */
int l, i, n=0; int l, i;
PyObject *base, *dbase; PyObject *base, *dbase;
l=PyTuple_Size(type->bases); l=PyTuple_Size(type->bases);
...@@ -2678,7 +2678,7 @@ datafull_baseclass(PyExtensionClass *type) ...@@ -2678,7 +2678,7 @@ datafull_baseclass(PyExtensionClass *type)
{ {
if(AsExtensionClass(base)->bases) if(AsExtensionClass(base)->bases)
{ {
if(dbase=datafull_baseclass(AsExtensionClass(base))) if((dbase=datafull_baseclass(AsExtensionClass(base))))
return dbase; return dbase;
} }
else else
...@@ -2697,7 +2697,7 @@ static PyObject * ...@@ -2697,7 +2697,7 @@ static PyObject *
extension_baseclass(PyExtensionClass *type) extension_baseclass(PyExtensionClass *type)
{ {
/* Find the first immediate base class that is an extension class */ /* Find the first immediate base class that is an extension class */
int l, i, n=0; int l, i;
PyObject *base; PyObject *base;
l=PyTuple_Size(type->bases); l=PyTuple_Size(type->bases);
...@@ -2715,7 +2715,7 @@ subclass_hasattr(PyExtensionClass *type, PyObject *name) ...@@ -2715,7 +2715,7 @@ subclass_hasattr(PyExtensionClass *type, PyObject *name)
{ {
PyObject *o; PyObject *o;
if(o=CCL_getattro(type,name)) if((o=CCL_getattro(type,name)))
{ {
Py_DECREF(o); Py_DECREF(o);
return 1; return 1;
...@@ -2910,7 +2910,7 @@ subclass__init__(PyExtensionClass *self, PyObject *args) ...@@ -2910,7 +2910,7 @@ subclass__init__(PyExtensionClass *self, PyObject *args)
self->tp_doc=0; self->tp_doc=0;
/* Check for and use __class_init__ */ /* Check for and use __class_init__ */
if(class_init=PyObject_GetAttrString(AsPyObject(self),"__class_init__")) if((class_init=PyObject_GetAttrString(AsPyObject(self),"__class_init__")))
{ {
UNLESS_ASSIGN(class_init,PyObject_GetAttrString(class_init,"im_func")) UNLESS_ASSIGN(class_init,PyObject_GetAttrString(class_init,"im_func"))
return NULL; return NULL;
...@@ -3005,7 +3005,7 @@ void ...@@ -3005,7 +3005,7 @@ void
initExtensionClass() initExtensionClass()
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.13 $"; char *rev="$Revision: 1.14 $";
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;
...@@ -3023,6 +3023,8 @@ initExtensionClass() ...@@ -3023,6 +3023,8 @@ initExtensionClass()
init_py_names(); init_py_names();
if(0) PyCObject_Import14("this will go away", "in 1.5 :-)");
initializeBaseExtensionClass(&ECType); initializeBaseExtensionClass(&ECType);
PyDict_SetItemString(d, "ExtensionClass", (PyObject*)&ECType); PyDict_SetItemString(d, "ExtensionClass", (PyObject*)&ECType);
...@@ -3042,6 +3044,10 @@ initExtensionClass() ...@@ -3042,6 +3044,10 @@ initExtensionClass()
/**************************************************************************** /****************************************************************************
$Log: ExtensionClass.c,v $ $Log: ExtensionClass.c,v $
Revision 1.14 1997/07/02 20:17:15 jim
Added stupid parens and other changes to make 'gcc -Wall -pedantic'
and Barry happy. Got rid of some extra variable declarations.
Revision 1.13 1997/07/02 17:33:39 jim Revision 1.13 1997/07/02 17:33:39 jim
Included my version of PyErr_Format. Included my version of PyErr_Format.
......
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