From ee238b977fb7a58a4b88bdab087579d067df6451 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Sun, 9 Jul 2000 06:03:25 +0000 Subject: ANSI-fication of the sources. --- Objects/funcobject.c | 38 +++++++++++--------------------------- Objects/methodobject.c | 44 +++++++++++++------------------------------- Objects/moduleobject.c | 30 +++++++++--------------------- 3 files changed, 33 insertions(+), 79 deletions(-) diff --git a/Objects/funcobject.c b/Objects/funcobject.c index b6c0089..32d9a61 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -15,9 +15,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. #include "structmember.h" PyObject * -PyFunction_New(code, globals) - PyObject *code; - PyObject *globals; +PyFunction_New(PyObject *code, PyObject *globals) { PyFunctionObject *op = PyObject_NEW(PyFunctionObject, &PyFunction_Type); @@ -47,8 +45,7 @@ PyFunction_New(code, globals) } PyObject * -PyFunction_GetCode(op) - PyObject *op; +PyFunction_GetCode(PyObject *op) { if (!PyFunction_Check(op)) { PyErr_BadInternalCall(); @@ -58,8 +55,7 @@ PyFunction_GetCode(op) } PyObject * -PyFunction_GetGlobals(op) - PyObject *op; +PyFunction_GetGlobals(PyObject *op) { if (!PyFunction_Check(op)) { PyErr_BadInternalCall(); @@ -69,8 +65,7 @@ PyFunction_GetGlobals(op) } PyObject * -PyFunction_GetDefaults(op) - PyObject *op; +PyFunction_GetDefaults(PyObject *op) { if (!PyFunction_Check(op)) { PyErr_BadInternalCall(); @@ -80,9 +75,7 @@ PyFunction_GetDefaults(op) } int -PyFunction_SetDefaults(op, defaults) - PyObject *op; - PyObject *defaults; +PyFunction_SetDefaults(PyObject *op, PyObject *defaults) { if (!PyFunction_Check(op)) { PyErr_BadInternalCall(); @@ -118,9 +111,7 @@ static struct memberlist func_memberlist[] = { }; static PyObject * -func_getattr(op, name) - PyFunctionObject *op; - char *name; +func_getattr(PyFunctionObject *op, char *name) { if (name[0] != '_' && PyEval_GetRestricted()) { PyErr_SetString(PyExc_RuntimeError, @@ -131,10 +122,7 @@ func_getattr(op, name) } static int -func_setattr(op, name, value) - PyFunctionObject *op; - char *name; - PyObject *value; +func_setattr(PyFunctionObject *op, char *name, PyObject *value) { if (PyEval_GetRestricted()) { PyErr_SetString(PyExc_RuntimeError, @@ -163,8 +151,7 @@ func_setattr(op, name, value) } static void -func_dealloc(op) - PyFunctionObject *op; +func_dealloc(PyFunctionObject *op) { PyObject_GC_Fini(op); Py_DECREF(op->func_code); @@ -177,8 +164,7 @@ func_dealloc(op) } static PyObject* -func_repr(op) - PyFunctionObject *op; +func_repr(PyFunctionObject *op) { char buf[140]; if (op->func_name == Py_None) @@ -191,8 +177,7 @@ func_repr(op) } static int -func_compare(f, g) - PyFunctionObject *f, *g; +func_compare(PyFunctionObject *f, PyFunctionObject *g) { int c; if (f->func_globals != g->func_globals) @@ -210,8 +195,7 @@ func_compare(f, g) } static long -func_hash(f) - PyFunctionObject *f; +func_hash(PyFunctionObject *f) { long h,x; h = PyObject_Hash(f->func_code); diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 4874c28..4a1fa93 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -17,9 +17,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. static PyCFunctionObject *free_list = NULL; PyObject * -PyCFunction_New(ml, self) - PyMethodDef *ml; - PyObject *self; +PyCFunction_New(PyMethodDef *ml, PyObject *self) { PyCFunctionObject *op; op = free_list; @@ -39,8 +37,7 @@ PyCFunction_New(ml, self) } PyCFunction -PyCFunction_GetFunction(op) - PyObject *op; +PyCFunction_GetFunction(PyObject *op) { if (!PyCFunction_Check(op)) { PyErr_BadInternalCall(); @@ -50,8 +47,7 @@ PyCFunction_GetFunction(op) } PyObject * -PyCFunction_GetSelf(op) - PyObject *op; +PyCFunction_GetSelf(PyObject *op) { if (!PyCFunction_Check(op)) { PyErr_BadInternalCall(); @@ -61,8 +57,7 @@ PyCFunction_GetSelf(op) } int -PyCFunction_GetFlags(op) - PyObject *op; +PyCFunction_GetFlags(PyObject *op) { if (!PyCFunction_Check(op)) { PyErr_BadInternalCall(); @@ -74,8 +69,7 @@ PyCFunction_GetFlags(op) /* Methods (the standard built-in methods, that is) */ static void -meth_dealloc(m) - PyCFunctionObject *m; +meth_dealloc(PyCFunctionObject *m) { Py_XDECREF(m->m_self); m->m_self = (PyObject *)free_list; @@ -83,9 +77,7 @@ meth_dealloc(m) } static PyObject * -meth_getattr(m, name) - PyCFunctionObject *m; - char *name; +meth_getattr(PyCFunctionObject *m, char *name) { if (strcmp(name, "__name__") == 0) { return PyString_FromString(m->m_ml->ml_name); @@ -119,8 +111,7 @@ meth_getattr(m, name) } static PyObject * -meth_repr(m) - PyCFunctionObject *m; +meth_repr(PyCFunctionObject *m) { char buf[200]; if (m->m_self == NULL) @@ -134,8 +125,7 @@ meth_repr(m) } static int -meth_compare(a, b) - PyCFunctionObject *a, *b; +meth_compare(PyCFunctionObject *a, PyCFunctionObject *b) { if (a->m_self != b->m_self) return (a->m_self < b->m_self) ? -1 : 1; @@ -148,8 +138,7 @@ meth_compare(a, b) } static long -meth_hash(a) - PyCFunctionObject *a; +meth_hash(PyCFunctionObject *a) { long x,y; if (a->m_self == NULL) @@ -189,8 +178,7 @@ PyTypeObject PyCFunction_Type = { /* List all methods in a chain -- helper for findmethodinchain */ static PyObject * -listmethodchain(chain) - PyMethodChain *chain; +listmethodchain(PyMethodChain *chain) { PyMethodChain *c; PyMethodDef *ml; @@ -223,10 +211,7 @@ listmethodchain(chain) /* Find a method in a method chain */ PyObject * -Py_FindMethodInChain(chain, self, name) - PyMethodChain *chain; - PyObject *self; - char *name; +Py_FindMethodInChain(PyMethodChain *chain, PyObject *self, char *name) { if (name[0] == '_' && name[1] == '_') { if (strcmp(name, "__methods__") == 0) @@ -253,10 +238,7 @@ Py_FindMethodInChain(chain, self, name) /* Find a method in a single method list */ PyObject * -Py_FindMethod(methods, self, name) - PyMethodDef *methods; - PyObject *self; - char *name; +Py_FindMethod(PyMethodDef *methods, PyObject *self, char *name) { PyMethodChain chain; chain.methods = methods; @@ -267,7 +249,7 @@ Py_FindMethod(methods, self, name) /* Clear out the free list */ void -PyCFunction_Fini() +PyCFunction_Fini(void) { while (free_list) { PyCFunctionObject *v = free_list; diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 23b630c..4e4395e 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -18,8 +18,7 @@ typedef struct { } PyModuleObject; PyObject * -PyModule_New(name) - char *name; +PyModule_New(char *name) { PyModuleObject *m; PyObject *nameobj; @@ -44,8 +43,7 @@ PyModule_New(name) } PyObject * -PyModule_GetDict(m) - PyObject *m; +PyModule_GetDict(PyObject *m) { if (!PyModule_Check(m)) { PyErr_BadInternalCall(); @@ -55,8 +53,7 @@ PyModule_GetDict(m) } char * -PyModule_GetName(m) - PyObject *m; +PyModule_GetName(PyObject *m) { PyObject *nameobj; if (!PyModule_Check(m)) { @@ -73,8 +70,7 @@ PyModule_GetName(m) } char * -PyModule_GetFilename(m) - PyObject *m; +PyModule_GetFilename(PyObject *m) { PyObject *fileobj; if (!PyModule_Check(m)) { @@ -91,8 +87,7 @@ PyModule_GetFilename(m) } void -_PyModule_Clear(m) - PyObject *m; +_PyModule_Clear(PyObject *m) { /* To make the execution order of destructors for global objects a bit more predictable, we first zap all objects @@ -142,8 +137,7 @@ _PyModule_Clear(m) /* Methods */ static void -module_dealloc(m) - PyModuleObject *m; +module_dealloc(PyModuleObject *m) { if (m->md_dict != NULL) { _PyModule_Clear((PyObject *)m); @@ -153,8 +147,7 @@ module_dealloc(m) } static PyObject * -module_repr(m) - PyModuleObject *m; +module_repr(PyModuleObject *m) { char buf[400]; char *name; @@ -176,9 +169,7 @@ module_repr(m) } static PyObject * -module_getattr(m, name) - PyModuleObject *m; - char *name; +module_getattr(PyModuleObject *m, char *name) { PyObject *res; if (strcmp(name, "__dict__") == 0) { @@ -194,10 +185,7 @@ module_getattr(m, name) } static int -module_setattr(m, name, v) - PyModuleObject *m; - char *name; - PyObject *v; +module_setattr(PyModuleObject *m, char *name, PyObject *v) { if (name[0] == '_' && strcmp(name, "__dict__") == 0) { PyErr_SetString(PyExc_TypeError, -- cgit v0.12