Commit ba09633e authored by Fred Drake's avatar Fred Drake

ANSI-fication of the sources.

parent 45cfbccc
This diff is collapsed.
...@@ -33,8 +33,7 @@ int tuple_zero_allocs; ...@@ -33,8 +33,7 @@ int tuple_zero_allocs;
#endif #endif
PyObject * PyObject *
PyTuple_New(size) PyTuple_New(register int size)
register int size;
{ {
register int i; register int i;
register PyTupleObject *op; register PyTupleObject *op;
...@@ -99,8 +98,7 @@ PyTuple_New(size) ...@@ -99,8 +98,7 @@ PyTuple_New(size)
} }
int int
PyTuple_Size(op) PyTuple_Size(register PyObject *op)
register PyObject *op;
{ {
if (!PyTuple_Check(op)) { if (!PyTuple_Check(op)) {
PyErr_BadInternalCall(); PyErr_BadInternalCall();
...@@ -111,9 +109,7 @@ PyTuple_Size(op) ...@@ -111,9 +109,7 @@ PyTuple_Size(op)
} }
PyObject * PyObject *
PyTuple_GetItem(op, i) PyTuple_GetItem(register PyObject *op, register int i)
register PyObject *op;
register int i;
{ {
if (!PyTuple_Check(op)) { if (!PyTuple_Check(op)) {
PyErr_BadInternalCall(); PyErr_BadInternalCall();
...@@ -127,10 +123,7 @@ PyTuple_GetItem(op, i) ...@@ -127,10 +123,7 @@ PyTuple_GetItem(op, i)
} }
int int
PyTuple_SetItem(op, i, newitem) PyTuple_SetItem(register PyObject *op, register int i, PyObject *newitem)
register PyObject *op;
register int i;
PyObject *newitem;
{ {
register PyObject *olditem; register PyObject *olditem;
register PyObject **p; register PyObject **p;
...@@ -155,8 +148,7 @@ PyTuple_SetItem(op, i, newitem) ...@@ -155,8 +148,7 @@ PyTuple_SetItem(op, i, newitem)
/* Methods */ /* Methods */
static void static void
tupledealloc(op) tupledealloc(register PyTupleObject *op)
register PyTupleObject *op;
{ {
register int i; register int i;
register int len = op->ob_size; register int len = op->ob_size;
...@@ -182,10 +174,7 @@ done: ...@@ -182,10 +174,7 @@ done:
} }
static int static int
tupleprint(op, fp, flags) tupleprint(PyTupleObject *op, FILE *fp, int flags)
PyTupleObject *op;
FILE *fp;
int flags;
{ {
int i; int i;
fprintf(fp, "("); fprintf(fp, "(");
...@@ -202,8 +191,7 @@ tupleprint(op, fp, flags) ...@@ -202,8 +191,7 @@ tupleprint(op, fp, flags)
} }
static PyObject * static PyObject *
tuplerepr(v) tuplerepr(PyTupleObject *v)
PyTupleObject *v;
{ {
PyObject *s, *comma; PyObject *s, *comma;
int i; int i;
...@@ -222,8 +210,7 @@ tuplerepr(v) ...@@ -222,8 +210,7 @@ tuplerepr(v)
} }
static int static int
tuplecompare(v, w) tuplecompare(register PyTupleObject *v, register PyTupleObject *w)
register PyTupleObject *v, *w;
{ {
register int len = register int len =
(v->ob_size < w->ob_size) ? v->ob_size : w->ob_size; (v->ob_size < w->ob_size) ? v->ob_size : w->ob_size;
...@@ -237,8 +224,7 @@ tuplecompare(v, w) ...@@ -237,8 +224,7 @@ tuplecompare(v, w)
} }
static long static long
tuplehash(v) tuplehash(PyTupleObject *v)
PyTupleObject *v;
{ {
register long x, y; register long x, y;
register int len = v->ob_size; register int len = v->ob_size;
...@@ -258,16 +244,13 @@ tuplehash(v) ...@@ -258,16 +244,13 @@ tuplehash(v)
} }
static int static int
tuplelength(a) tuplelength(PyTupleObject *a)
PyTupleObject *a;
{ {
return a->ob_size; return a->ob_size;
} }
static int static int
tuplecontains(a, el) tuplecontains(PyTupleObject *a, PyObject *el)
PyTupleObject *a;
PyObject *el;
{ {
int i, cmp; int i, cmp;
...@@ -282,9 +265,7 @@ tuplecontains(a, el) ...@@ -282,9 +265,7 @@ tuplecontains(a, el)
} }
static PyObject * static PyObject *
tupleitem(a, i) tupleitem(register PyTupleObject *a, register int i)
register PyTupleObject *a;
register int i;
{ {
if (i < 0 || i >= a->ob_size) { if (i < 0 || i >= a->ob_size) {
PyErr_SetString(PyExc_IndexError, "tuple index out of range"); PyErr_SetString(PyExc_IndexError, "tuple index out of range");
...@@ -295,9 +276,7 @@ tupleitem(a, i) ...@@ -295,9 +276,7 @@ tupleitem(a, i)
} }
static PyObject * static PyObject *
tupleslice(a, ilow, ihigh) tupleslice(register PyTupleObject *a, register int ilow, register int ihigh)
register PyTupleObject *a;
register int ilow, ihigh;
{ {
register PyTupleObject *np; register PyTupleObject *np;
register int i; register int i;
...@@ -324,9 +303,7 @@ tupleslice(a, ilow, ihigh) ...@@ -324,9 +303,7 @@ tupleslice(a, ilow, ihigh)
} }
PyObject * PyObject *
PyTuple_GetSlice(op, i, j) PyTuple_GetSlice(PyObject *op, int i, int j)
PyObject *op;
int i, j;
{ {
if (op == NULL || !PyTuple_Check(op)) { if (op == NULL || !PyTuple_Check(op)) {
PyErr_BadInternalCall(); PyErr_BadInternalCall();
...@@ -336,9 +313,7 @@ PyTuple_GetSlice(op, i, j) ...@@ -336,9 +313,7 @@ PyTuple_GetSlice(op, i, j)
} }
static PyObject * static PyObject *
tupleconcat(a, bb) tupleconcat(register PyTupleObject *a, register PyObject *bb)
register PyTupleObject *a;
register PyObject *bb;
{ {
register int size; register int size;
register int i; register int i;
...@@ -370,9 +345,7 @@ tupleconcat(a, bb) ...@@ -370,9 +345,7 @@ tupleconcat(a, bb)
} }
static PyObject * static PyObject *
tuplerepeat(a, n) tuplerepeat(PyTupleObject *a, int n)
PyTupleObject *a;
int n;
{ {
int i, j; int i, j;
int size; int size;
...@@ -467,10 +440,7 @@ PyTypeObject PyTuple_Type = { ...@@ -467,10 +440,7 @@ PyTypeObject PyTuple_Type = {
front, otherwise it will grow or shrink at the end. */ front, otherwise it will grow or shrink at the end. */
int int
_PyTuple_Resize(pv, newsize, last_is_sticky) _PyTuple_Resize(PyObject **pv, int newsize, int last_is_sticky)
PyObject **pv;
int newsize;
int last_is_sticky;
{ {
register PyTupleObject *v; register PyTupleObject *v;
register PyTupleObject *sv; register PyTupleObject *sv;
...@@ -582,7 +552,7 @@ _PyTuple_Resize(pv, newsize, last_is_sticky) ...@@ -582,7 +552,7 @@ _PyTuple_Resize(pv, newsize, last_is_sticky)
} }
void void
PyTuple_Fini() PyTuple_Fini(void)
{ {
#if MAXSAVESIZE > 0 #if MAXSAVESIZE > 0
int i; int i;
......
...@@ -32,8 +32,7 @@ staticforward PyTypeObject Xxtype; ...@@ -32,8 +32,7 @@ staticforward PyTypeObject Xxtype;
#define is_xxobject(v) ((v)->ob_type == &Xxtype) #define is_xxobject(v) ((v)->ob_type == &Xxtype)
static xxobject * static xxobject *
newxxobject(arg) newxxobject(PyObject *arg)
PyObject *arg;
{ {
xxobject *xp; xxobject *xp;
xp = PyObject_NEW(xxobject, &Xxtype); xp = PyObject_NEW(xxobject, &Xxtype);
...@@ -46,33 +45,28 @@ newxxobject(arg) ...@@ -46,33 +45,28 @@ newxxobject(arg)
/* Xx methods */ /* Xx methods */
static void static void
xx_dealloc(xp) xx_dealloc(xxobject *xp)
xxobject *xp;
{ {
Py_XDECREF(xp->x_attr); Py_XDECREF(xp->x_attr);
PyObject_DEL(xp); PyObject_DEL(xp);
} }
static PyObject * static PyObject *
xx_demo(self, args) xx_demo(xxobject *self, PyObject *args)
xxobject *self;
PyObject *args;
{ {
if (!PyArg_NoArgs(args)) if (!PyArg_ParseTuple(args, ":demo"))
return NULL; return NULL;
Py_INCREF(Py_None); Py_INCREF(Py_None);
return Py_None; return Py_None;
} }
static PyMethodDef xx_methods[] = { static PyMethodDef xx_methods[] = {
{"demo", (PyCFunction)xx_demo}, {"demo", (PyCFunction)xx_demo, METH_VARARGS},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };
static PyObject * static PyObject *
xx_getattr(xp, name) xx_getattr(xxobject *xp, char *name)
xxobject *xp;
char *name;
{ {
if (xp->x_attr != NULL) { if (xp->x_attr != NULL) {
PyObject *v = PyDict_GetItemString(xp->x_attr, name); PyObject *v = PyDict_GetItemString(xp->x_attr, name);
...@@ -85,10 +79,7 @@ xx_getattr(xp, name) ...@@ -85,10 +79,7 @@ xx_getattr(xp, name)
} }
static int static int
xx_setattr(xp, name, v) xx_setattr(xxobject *xp, char *name, PyObject *v)
xxobject *xp;
char *name;
PyObject *v;
{ {
if (xp->x_attr == NULL) { if (xp->x_attr == NULL) {
xp->x_attr = PyDict_New(); xp->x_attr = PyDict_New();
......
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