Kaydet (Commit) 100814dc authored tarafından Fred Drake's avatar Fred Drake

ANSI-fication of the sources.

üst a2f55119
...@@ -33,7 +33,7 @@ extern int tuple_zero_allocs, fast_tuple_allocs; ...@@ -33,7 +33,7 @@ extern int tuple_zero_allocs, fast_tuple_allocs;
extern int quick_int_allocs, quick_neg_int_allocs; extern int quick_int_allocs, quick_neg_int_allocs;
extern int null_strings, one_strings; extern int null_strings, one_strings;
void void
dump_counts() dump_counts(void)
{ {
PyTypeObject *tp; PyTypeObject *tp;
...@@ -50,7 +50,7 @@ dump_counts() ...@@ -50,7 +50,7 @@ dump_counts()
} }
PyObject * PyObject *
get_counts() get_counts(void)
{ {
PyTypeObject *tp; PyTypeObject *tp;
PyObject *result; PyObject *result;
...@@ -77,8 +77,7 @@ get_counts() ...@@ -77,8 +77,7 @@ get_counts()
} }
void void
inc_count(tp) inc_count(PyTypeObject *tp)
PyTypeObject *tp;
{ {
if (tp->tp_alloc == 0) { if (tp->tp_alloc == 0) {
/* first time; insert in linked list */ /* first time; insert in linked list */
...@@ -94,9 +93,7 @@ inc_count(tp) ...@@ -94,9 +93,7 @@ inc_count(tp)
#endif #endif
PyObject * PyObject *
PyObject_Init(op, tp) PyObject_Init(PyObject *op, PyTypeObject *tp)
PyObject *op;
PyTypeObject *tp;
{ {
if (op == NULL) { if (op == NULL) {
PyErr_SetString(PyExc_SystemError, PyErr_SetString(PyExc_SystemError,
...@@ -114,10 +111,7 @@ PyObject_Init(op, tp) ...@@ -114,10 +111,7 @@ PyObject_Init(op, tp)
} }
PyVarObject * PyVarObject *
PyObject_InitVar(op, tp, size) PyObject_InitVar(PyVarObject *op, PyTypeObject *tp, int size)
PyVarObject *op;
PyTypeObject *tp;
int size;
{ {
if (op == NULL) { if (op == NULL) {
PyErr_SetString(PyExc_SystemError, PyErr_SetString(PyExc_SystemError,
...@@ -136,8 +130,7 @@ PyObject_InitVar(op, tp, size) ...@@ -136,8 +130,7 @@ PyObject_InitVar(op, tp, size)
} }
PyObject * PyObject *
_PyObject_New(tp) _PyObject_New(PyTypeObject *tp)
PyTypeObject *tp;
{ {
PyObject *op; PyObject *op;
op = (PyObject *) PyObject_MALLOC(_PyObject_SIZE(tp)); op = (PyObject *) PyObject_MALLOC(_PyObject_SIZE(tp));
...@@ -151,9 +144,7 @@ _PyObject_New(tp) ...@@ -151,9 +144,7 @@ _PyObject_New(tp)
} }
PyVarObject * PyVarObject *
_PyObject_NewVar(tp, size) _PyObject_NewVar(PyTypeObject *tp, int size)
PyTypeObject *tp;
int size;
{ {
PyVarObject *op; PyVarObject *op;
op = (PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE(tp, size)); op = (PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE(tp, size));
...@@ -167,8 +158,7 @@ _PyObject_NewVar(tp, size) ...@@ -167,8 +158,7 @@ _PyObject_NewVar(tp, size)
} }
void void
_PyObject_Del(op) _PyObject_Del(PyObject *op)
PyObject *op;
{ {
#ifdef WITH_CYCLE_GC #ifdef WITH_CYCLE_GC
if (op && PyType_IS_GC(op->ob_type)) { if (op && PyType_IS_GC(op->ob_type)) {
...@@ -185,10 +175,7 @@ void _PyGC_Remove(PyObject *op) { } ...@@ -185,10 +175,7 @@ void _PyGC_Remove(PyObject *op) { }
#endif #endif
int int
PyObject_Print(op, fp, flags) PyObject_Print(PyObject *op, FILE *fp, int flags)
PyObject *op;
FILE *fp;
int flags;
{ {
int ret = 0; int ret = 0;
if (PyErr_CheckSignals()) if (PyErr_CheckSignals())
...@@ -241,8 +228,7 @@ PyObject_Print(op, fp, flags) ...@@ -241,8 +228,7 @@ PyObject_Print(op, fp, flags)
} }
PyObject * PyObject *
PyObject_Repr(v) PyObject_Repr(PyObject *v)
PyObject *v;
{ {
if (PyErr_CheckSignals()) if (PyErr_CheckSignals())
return NULL; return NULL;
...@@ -286,8 +272,7 @@ PyObject_Repr(v) ...@@ -286,8 +272,7 @@ PyObject_Repr(v)
} }
PyObject * PyObject *
PyObject_Str(v) PyObject_Str(PyObject *v)
PyObject *v;
{ {
PyObject *res; PyObject *res;
...@@ -331,8 +316,7 @@ PyObject_Str(v) ...@@ -331,8 +316,7 @@ PyObject_Str(v)
} }
static PyObject * static PyObject *
do_cmp(v, w) do_cmp(PyObject *v, PyObject *w)
PyObject *v, *w;
{ {
long c; long c;
/* __rcmp__ actually won't be called unless __cmp__ isn't defined, /* __rcmp__ actually won't be called unless __cmp__ isn't defined,
...@@ -357,7 +341,7 @@ PyObject *_PyCompareState_Key; ...@@ -357,7 +341,7 @@ PyObject *_PyCompareState_Key;
int _PyCompareState_nesting = 0; int _PyCompareState_nesting = 0;
static PyObject* static PyObject*
get_inprogress_dict() get_inprogress_dict(void)
{ {
PyObject *tstate_dict, *inprogress; PyObject *tstate_dict, *inprogress;
...@@ -383,8 +367,7 @@ get_inprogress_dict() ...@@ -383,8 +367,7 @@ get_inprogress_dict()
} }
static PyObject * static PyObject *
make_pair(v, w) make_pair(PyObject *v, PyObject *w)
PyObject *v, *w;
{ {
PyObject *pair; PyObject *pair;
...@@ -403,8 +386,7 @@ make_pair(v, w) ...@@ -403,8 +386,7 @@ make_pair(v, w)
} }
int int
PyObject_Compare(v, w) PyObject_Compare(PyObject *v, PyObject *w)
PyObject *v, *w;
{ {
PyTypeObject *vtp, *wtp; PyTypeObject *vtp, *wtp;
int result; int result;
...@@ -541,8 +523,7 @@ PyObject_Compare(v, w) ...@@ -541,8 +523,7 @@ PyObject_Compare(v, w)
*/ */
long long
_Py_HashDouble(v) _Py_HashDouble(double v)
double v;
{ {
/* Use frexp to get at the bits in the double. /* Use frexp to get at the bits in the double.
* Since the VAX D double format has 56 mantissa bits, which is the * Since the VAX D double format has 56 mantissa bits, which is the
...@@ -566,8 +547,7 @@ _Py_HashDouble(v) ...@@ -566,8 +547,7 @@ _Py_HashDouble(v)
} }
long long
_Py_HashPointer(p) _Py_HashPointer(void *p)
void *p;
{ {
#if SIZEOF_LONG >= SIZEOF_VOID_P #if SIZEOF_LONG >= SIZEOF_VOID_P
return (long)p; return (long)p;
...@@ -590,8 +570,7 @@ finally: ...@@ -590,8 +570,7 @@ finally:
long long
PyObject_Hash(v) PyObject_Hash(PyObject *v)
PyObject *v;
{ {
PyTypeObject *tp = v->ob_type; PyTypeObject *tp = v->ob_type;
if (tp->tp_hash != NULL) if (tp->tp_hash != NULL)
...@@ -605,9 +584,7 @@ PyObject_Hash(v) ...@@ -605,9 +584,7 @@ PyObject_Hash(v)
} }
PyObject * PyObject *
PyObject_GetAttrString(v, name) PyObject_GetAttrString(PyObject *v, char *name)
PyObject *v;
char *name;
{ {
if (v->ob_type->tp_getattro != NULL) { if (v->ob_type->tp_getattro != NULL) {
PyObject *w, *res; PyObject *w, *res;
...@@ -632,9 +609,7 @@ PyObject_GetAttrString(v, name) ...@@ -632,9 +609,7 @@ PyObject_GetAttrString(v, name)
} }
int int
PyObject_HasAttrString(v, name) PyObject_HasAttrString(PyObject *v, char *name)
PyObject *v;
char *name;
{ {
PyObject *res = PyObject_GetAttrString(v, name); PyObject *res = PyObject_GetAttrString(v, name);
if (res != NULL) { if (res != NULL) {
...@@ -646,10 +621,7 @@ PyObject_HasAttrString(v, name) ...@@ -646,10 +621,7 @@ PyObject_HasAttrString(v, name)
} }
int int
PyObject_SetAttrString(v, name, w) PyObject_SetAttrString(PyObject *v, char *name, PyObject *w)
PyObject *v;
char *name;
PyObject *w;
{ {
if (v->ob_type->tp_setattro != NULL) { if (v->ob_type->tp_setattro != NULL) {
PyObject *s; PyObject *s;
...@@ -677,9 +649,7 @@ PyObject_SetAttrString(v, name, w) ...@@ -677,9 +649,7 @@ PyObject_SetAttrString(v, name, w)
} }
PyObject * PyObject *
PyObject_GetAttr(v, name) PyObject_GetAttr(PyObject *v, PyObject *name)
PyObject *v;
PyObject *name;
{ {
if (v->ob_type->tp_getattro != NULL) if (v->ob_type->tp_getattro != NULL)
return (*v->ob_type->tp_getattro)(v, name); return (*v->ob_type->tp_getattro)(v, name);
...@@ -693,9 +663,7 @@ PyObject_GetAttr(v, name) ...@@ -693,9 +663,7 @@ PyObject_GetAttr(v, name)
} }
int int
PyObject_HasAttr(v, name) PyObject_HasAttr(PyObject *v, PyObject *name)
PyObject *v;
PyObject *name;
{ {
PyObject *res = PyObject_GetAttr(v, name); PyObject *res = PyObject_GetAttr(v, name);
if (res != NULL) { if (res != NULL) {
...@@ -707,10 +675,7 @@ PyObject_HasAttr(v, name) ...@@ -707,10 +675,7 @@ PyObject_HasAttr(v, name)
} }
int int
PyObject_SetAttr(v, name, value) PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value)
PyObject *v;
PyObject *name;
PyObject *value;
{ {
int err; int err;
Py_INCREF(name); Py_INCREF(name);
...@@ -735,8 +700,7 @@ PyObject_SetAttr(v, name, value) ...@@ -735,8 +700,7 @@ PyObject_SetAttr(v, name, value)
Return -1 if an error occurred */ Return -1 if an error occurred */
int int
PyObject_IsTrue(v) PyObject_IsTrue(PyObject *v)
PyObject *v;
{ {
int res; int res;
if (v == Py_None) if (v == Py_None)
...@@ -761,8 +725,7 @@ PyObject_IsTrue(v) ...@@ -761,8 +725,7 @@ PyObject_IsTrue(v)
Return -1 if an error occurred */ Return -1 if an error occurred */
int int
PyObject_Not(v) PyObject_Not(PyObject *v)
PyObject *v;
{ {
int res; int res;
res = PyObject_IsTrue(v); res = PyObject_IsTrue(v);
...@@ -778,8 +741,7 @@ PyObject_Not(v) ...@@ -778,8 +741,7 @@ PyObject_Not(v)
*/ */
int int
PyNumber_CoerceEx(pv, pw) PyNumber_CoerceEx(PyObject **pv, PyObject **pw)
PyObject **pv, **pw;
{ {
register PyObject *v = *pv; register PyObject *v = *pv;
register PyObject *w = *pw; register PyObject *w = *pw;
...@@ -804,8 +766,7 @@ PyNumber_CoerceEx(pv, pw) ...@@ -804,8 +766,7 @@ PyNumber_CoerceEx(pv, pw)
} }
int int
PyNumber_Coerce(pv, pw) PyNumber_Coerce(PyObject **pv, PyObject **pw)
PyObject **pv, **pw;
{ {
int err = PyNumber_CoerceEx(pv, pw); int err = PyNumber_CoerceEx(pv, pw);
if (err <= 0) if (err <= 0)
...@@ -818,8 +779,7 @@ PyNumber_Coerce(pv, pw) ...@@ -818,8 +779,7 @@ PyNumber_Coerce(pv, pw)
/* Test whether an object can be called */ /* Test whether an object can be called */
int int
PyCallable_Check(x) PyCallable_Check(PyObject *x)
PyObject *x;
{ {
if (x == NULL) if (x == NULL)
return 0; return 0;
...@@ -852,8 +812,7 @@ so there is exactly one (which is indestructible, by the way). ...@@ -852,8 +812,7 @@ so there is exactly one (which is indestructible, by the way).
/* ARGSUSED */ /* ARGSUSED */
static PyObject * static PyObject *
none_repr(op) none_repr(PyObject *op)
PyObject *op;
{ {
return PyString_FromString("None"); return PyString_FromString("None");
} }
...@@ -886,15 +845,14 @@ PyObject _Py_NoneStruct = { ...@@ -886,15 +845,14 @@ PyObject _Py_NoneStruct = {
static PyObject refchain = {&refchain, &refchain}; static PyObject refchain = {&refchain, &refchain};
void void
_Py_ResetReferences() _Py_ResetReferences(void)
{ {
refchain._ob_prev = refchain._ob_next = &refchain; refchain._ob_prev = refchain._ob_next = &refchain;
_Py_RefTotal = 0; _Py_RefTotal = 0;
} }
void void
_Py_NewReference(op) _Py_NewReference(PyObject *op)
PyObject *op;
{ {
_Py_RefTotal++; _Py_RefTotal++;
op->ob_refcnt = 1; op->ob_refcnt = 1;
...@@ -908,8 +866,7 @@ _Py_NewReference(op) ...@@ -908,8 +866,7 @@ _Py_NewReference(op)
} }
void void
_Py_ForgetReference(op) _Py_ForgetReference(register PyObject *op)
register PyObject *op;
{ {
#ifdef SLOW_UNREF_CHECK #ifdef SLOW_UNREF_CHECK
register PyObject *p; register PyObject *p;
...@@ -936,8 +893,7 @@ _Py_ForgetReference(op) ...@@ -936,8 +893,7 @@ _Py_ForgetReference(op)
} }
void void
_Py_Dealloc(op) _Py_Dealloc(PyObject *op)
PyObject *op;
{ {
destructor dealloc = op->ob_type->tp_dealloc; destructor dealloc = op->ob_type->tp_dealloc;
_Py_ForgetReference(op); _Py_ForgetReference(op);
...@@ -949,8 +905,7 @@ _Py_Dealloc(op) ...@@ -949,8 +905,7 @@ _Py_Dealloc(op)
} }
void void
_Py_PrintReferences(fp) _Py_PrintReferences(FILE *fp)
FILE *fp;
{ {
PyObject *op; PyObject *op;
fprintf(fp, "Remaining objects:\n"); fprintf(fp, "Remaining objects:\n");
...@@ -963,9 +918,7 @@ _Py_PrintReferences(fp) ...@@ -963,9 +918,7 @@ _Py_PrintReferences(fp)
} }
PyObject * PyObject *
_Py_GetObjects(self, args) _Py_GetObjects(PyObject *self, PyObject *args)
PyObject *self;
PyObject *args;
{ {
int i, n; int i, n;
PyObject *t = NULL; PyObject *t = NULL;
...@@ -1007,8 +960,7 @@ int (*_Py_abstract_hack)(PyObject *) = &PyObject_Length; ...@@ -1007,8 +960,7 @@ int (*_Py_abstract_hack)(PyObject *) = &PyObject_Length;
/* Python's malloc wrappers (see mymalloc.h) */ /* Python's malloc wrappers (see mymalloc.h) */
ANY * ANY *
PyMem_Malloc(nbytes) PyMem_Malloc(size_t nbytes)
size_t nbytes;
{ {
#if _PyMem_EXTRA > 0 #if _PyMem_EXTRA > 0
if (nbytes == 0) if (nbytes == 0)
...@@ -1018,9 +970,7 @@ PyMem_Malloc(nbytes) ...@@ -1018,9 +970,7 @@ PyMem_Malloc(nbytes)
} }
ANY * ANY *
PyMem_Realloc(p, nbytes) PyMem_Realloc(ANY *p, size_t nbytes)
ANY *p;
size_t nbytes;
{ {
#if _PyMem_EXTRA > 0 #if _PyMem_EXTRA > 0
if (nbytes == 0) if (nbytes == 0)
...@@ -1030,8 +980,7 @@ PyMem_Realloc(p, nbytes) ...@@ -1030,8 +980,7 @@ PyMem_Realloc(p, nbytes)
} }
void void
PyMem_Free(p) PyMem_Free(ANY *p)
ANY *p;
{ {
PyMem_FREE(p); PyMem_FREE(p);
} }
...@@ -1040,23 +989,19 @@ PyMem_Free(p) ...@@ -1040,23 +989,19 @@ PyMem_Free(p)
/* Python's object malloc wrappers (see objimpl.h) */ /* Python's object malloc wrappers (see objimpl.h) */
ANY * ANY *
PyObject_Malloc(nbytes) PyObject_Malloc(size_t nbytes)
size_t nbytes;
{ {
return PyObject_MALLOC(nbytes); return PyObject_MALLOC(nbytes);
} }
ANY * ANY *
PyObject_Realloc(p, nbytes) PyObject_Realloc(ANY *p, size_t nbytes)
ANY *p;
size_t nbytes;
{ {
return PyObject_REALLOC(p, nbytes); return PyObject_REALLOC(p, nbytes);
} }
void void
PyObject_Free(p) PyObject_Free(ANY *p)
ANY *p;
{ {
PyObject_FREE(p); PyObject_FREE(p);
} }
...@@ -1077,8 +1022,7 @@ PyObject_Free(p) ...@@ -1077,8 +1022,7 @@ PyObject_Free(p)
#define KEY "Py_Repr" #define KEY "Py_Repr"
int int
Py_ReprEnter(obj) Py_ReprEnter(PyObject *obj)
PyObject *obj;
{ {
PyObject *dict; PyObject *dict;
PyObject *list; PyObject *list;
...@@ -1106,8 +1050,7 @@ Py_ReprEnter(obj) ...@@ -1106,8 +1050,7 @@ Py_ReprEnter(obj)
} }
void void
Py_ReprLeave(obj) Py_ReprLeave(PyObject *obj)
PyObject *obj;
{ {
PyObject *dict; PyObject *dict;
PyObject *list; PyObject *list;
...@@ -1165,8 +1108,7 @@ int _PyTrash_delete_nesting = 0; ...@@ -1165,8 +1108,7 @@ int _PyTrash_delete_nesting = 0;
PyObject * _PyTrash_delete_later = NULL; PyObject * _PyTrash_delete_later = NULL;
void void
_PyTrash_deposit_object(op) _PyTrash_deposit_object(PyObject *op)
PyObject *op;
{ {
int typecode; int typecode;
...@@ -1187,7 +1129,7 @@ _PyTrash_deposit_object(op) ...@@ -1187,7 +1129,7 @@ _PyTrash_deposit_object(op)
} }
void void
_PyTrash_destroy_chain() _PyTrash_destroy_chain(void)
{ {
while (_PyTrash_delete_later) { while (_PyTrash_delete_later) {
PyObject *shredder = _PyTrash_delete_later; PyObject *shredder = _PyTrash_delete_later;
...@@ -1217,4 +1159,3 @@ _PyTrash_destroy_chain() ...@@ -1217,4 +1159,3 @@ _PyTrash_destroy_chain()
--_PyTrash_delete_nesting; --_PyTrash_delete_nesting;
} }
} }
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