]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix two instances of empty argument lists, and fix style
authorThomas Wouters <thomas@python.org>
Sat, 22 Jul 2000 18:45:06 +0000 (18:45 +0000)
committerThomas Wouters <thomas@python.org>
Sat, 22 Jul 2000 18:45:06 +0000 (18:45 +0000)
('PyObject** x' -> 'PyObject **x')

Python/exceptions.c

index b63daee18f7d5086daacea2fe4653e89ddf9bf40..d9bf0a01703a0bf704154a188da7a152ec6dfa3c 100644 (file)
@@ -101,15 +101,15 @@ Exception\n\
 \f
 /* Helper function for populating a dictionary with method wrappers. */
 static int
-populate_methods(PyObject* klass, PyObject* dict, PyMethodDef* methods) 
+populate_methods(PyObject *klass, PyObject *dict, PyMethodDef *methods)
 {
     if (!methods)
        return 0;
 
     while (methods->ml_name) {
        /* get a wrapper for the built-in function */
-       PyObjectfunc = PyCFunction_New(methods, NULL);
-       PyObjectmeth;
+       PyObject *func = PyCFunction_New(methods, NULL);
+       PyObject *meth;
        int status;
 
        if (!func)
@@ -139,12 +139,12 @@ populate_methods(PyObject* klass, PyObject* dict, PyMethodDef* methods)
 \f
 /* This function is used to create all subsequent exception classes. */
 static int
-make_class(PyObject** klass, PyObject* base,
-          char* name, PyMethodDef* methods,
-          chardocstr)
+make_class(PyObject **klass, PyObject *base,
+          char *name, PyMethodDef *methods,
+          char *docstr)
 {
-    PyObjectdict = PyDict_New();
-    PyObjectstr = NULL;
+    PyObject *dict = PyDict_New();
+    PyObject *str = NULL;
     int status = -1;
 
     if (!dict)
@@ -179,9 +179,10 @@ make_class(PyObject** klass, PyObject* base,
 
 
 /* Use this for *args signatures, otherwise just use PyArg_ParseTuple() */
-static PyObject* get_self(PyObject* args)
+static PyObject *
+get_self(PyObject *args)
 {
-    PyObjectself = PyTuple_GetItem(args, 0);
+    PyObject *self = PyTuple_GetItem(args, 0);
     if (!self) {
        /* Watch out for being called to early in the bootstrapping process */
        if (PyExc_TypeError) {
@@ -215,8 +216,8 @@ static char
 Exception__doc__[] = "Common base class for all exceptions.";
 
 
-static PyObject*
-Exception__init__(PyObject* self, PyObject* args)
+static PyObject *
+Exception__init__(PyObject *self, PyObject *args)
 {
     int status;
 
@@ -238,10 +239,10 @@ Exception__init__(PyObject* self, PyObject* args)
 }
 
 
-static PyObject*
-Exception__str__(PyObject* self, PyObject* args)
+static PyObject *
+Exception__str__(PyObject *self, PyObject *args)
 {
-    PyObjectout;
+    PyObject *out;
 
     if (!PyArg_ParseTuple(args, "O", &self))
         return NULL;
@@ -256,7 +257,7 @@ Exception__str__(PyObject* self, PyObject* args)
         break;
     case 1:
     {
-       PyObjecttmp = PySequence_GetItem(args, 0);
+       PyObject *tmp = PySequence_GetItem(args, 0);
        if (tmp) {
            out = PyObject_Str(tmp);
            Py_DECREF(tmp);
@@ -275,11 +276,11 @@ Exception__str__(PyObject* self, PyObject* args)
 }
 
 
-static PyObject*
-Exception__getitem__(PyObject* self, PyObject* args)
+static PyObject *
+Exception__getitem__(PyObject *self, PyObject *args)
 {
-    PyObjectout;
-    PyObjectindex;
+    PyObject *out;
+    PyObject *index;
 
     if (!PyArg_ParseTuple(args, "OO", &self, &index))
         return NULL;
@@ -305,11 +306,11 @@ Exception_methods[] = {
 
 
 static int
-make_Exception(charmodulename)
+make_Exception(char *modulename)
 {
-    PyObjectdict = PyDict_New();
-    PyObjectstr = NULL;
-    PyObjectname = NULL;
+    PyObject *dict = PyDict_New();
+    PyObject *str = NULL;
+    PyObject *name = NULL;
     int status = -1;
 
     if (!dict)
@@ -365,10 +366,10 @@ static char
 SystemExit__doc__[] = "Request to exit from the interpreter.";
 
 
-static PyObject*
-SystemExit__init__(PyObject* self, PyObject* args)
+static PyObject *
+SystemExit__init__(PyObject *self, PyObject *args)
 {
-    PyObjectcode;
+    PyObject *code;
     int status;
 
     if (!(self = get_self(args)))
@@ -430,14 +431,14 @@ static char
 EnvironmentError__doc__[] = "Base class for I/O related errors.";
 
 
-static PyObject*
-EnvironmentError__init__(PyObject* self, PyObject* args) 
+static PyObject *
+EnvironmentError__init__(PyObject *self, PyObject *args)
 {
-    PyObjectitem0 = NULL;
-    PyObjectitem1 = NULL;
-    PyObjectitem2 = NULL;
-    PyObjectsubslice = NULL;
-    PyObjectrtnval = NULL;
+    PyObject *item0 = NULL;
+    PyObject *item1 = NULL;
+    PyObject *item2 = NULL;
+    PyObject *subslice = NULL;
+    PyObject *rtnval = NULL;
 
     if (!(self = get_self(args)))
        return NULL;
@@ -514,14 +515,14 @@ EnvironmentError__init__(PyObject* self, PyObject* args)
 }
 
 
-static PyObject*
-EnvironmentError__str__(PyObject* self, PyObject* args) 
+static PyObject *
+EnvironmentError__str__(PyObject *self, PyObject *args)
 {
-    PyObjectoriginalself = self;
-    PyObjectfilename;
-    PyObjectserrno;
-    PyObjectstrerror;
-    PyObjectrtnval = NULL;
+    PyObject *originalself = self;
+    PyObject *filename;
+    PyObject *serrno;
+    PyObject *strerror;
+    PyObject *rtnval = NULL;
 
     if (!PyArg_ParseTuple(args, "O", &self))
        return NULL;
@@ -533,9 +534,9 @@ EnvironmentError__str__(PyObject* self, PyObject* args)
        goto finally;
 
     if (filename != Py_None) {
-       PyObjectfmt = PyString_FromString("[Errno %s] %s: %s");
-       PyObjectrepr = PyObject_Repr(filename);
-       PyObjecttuple = PyTuple_New(3);
+       PyObject *fmt = PyString_FromString("[Errno %s] %s: %s");
+       PyObject *repr = PyObject_Repr(filename);
+       PyObject *tuple = PyTuple_New(3);
 
        if (!fmt || !repr || !tuple) {
            Py_XDECREF(fmt);
@@ -557,8 +558,8 @@ EnvironmentError__str__(PyObject* self, PyObject* args)
        strerror = NULL;
     }
     else if (PyObject_IsTrue(serrno) && PyObject_IsTrue(strerror)) {
-       PyObjectfmt = PyString_FromString("[Errno %s] %s");
-       PyObjecttuple = PyTuple_New(2);
+       PyObject *fmt = PyString_FromString("[Errno %s] %s");
+       PyObject *tuple = PyTuple_New(2);
 
        if (!fmt || !tuple) {
            Py_XDECREF(fmt);
@@ -643,9 +644,9 @@ SyntaxError__doc__[] = "Invalid syntax.";
 
 
 static int
-SyntaxError__classinit__(PyObjectklass)
+SyntaxError__classinit__(PyObject *klass)
 {
-    PyObjectemptystring = PyString_FromString("");
+    PyObject *emptystring = PyString_FromString("");
 
     /* Additional class-creation time initializations */
     if (!emptystring ||
@@ -663,10 +664,10 @@ SyntaxError__classinit__(PyObject* klass)
 }
 
 
-static PyObject*
-SyntaxError__init__(PyObject* self, PyObject* args)
+static PyObject *
+SyntaxError__init__(PyObject *self, PyObject *args)
 {
-    PyObjectrtnval = NULL;
+    PyObject *rtnval = NULL;
     int lenargs;
 
     if (!(self = get_self(args)))
@@ -680,7 +681,7 @@ SyntaxError__init__(PyObject* self, PyObject* args)
 
     lenargs = PySequence_Size(args);
     if (lenargs >= 1) {
-       PyObjectitem0 = PySequence_GetItem(args, 0);
+       PyObject *item0 = PySequence_GetItem(args, 0);
        int status;
 
        if (!item0)
@@ -691,7 +692,7 @@ SyntaxError__init__(PyObject* self, PyObject* args)
            goto finally;
     }
     if (lenargs == 2) {
-       PyObjectinfo = PySequence_GetItem(args, 1);
+       PyObject *info = PySequence_GetItem(args, 1);
        PyObject *filename, *lineno, *offset, *text;
        int status = 1;
 
@@ -728,11 +729,11 @@ SyntaxError__init__(PyObject* self, PyObject* args)
 }
 
 
-static PyObject*
-SyntaxError__str__(PyObject* self, PyObject* args)
+static PyObject *
+SyntaxError__str__(PyObject *self, PyObject *args)
 {
-    PyObjectmsg;
-    PyObjectstr;
+    PyObject *msg;
+    PyObject *str;
 
     if (!PyArg_ParseTuple(args, "O", &self))
        return NULL;
@@ -854,17 +855,15 @@ PyObject *PyExc_MemoryErrorInst;
 
 
 \f
-/* mapping between exception names and their PyObject** */
-static struct
-{
-    char* name;
-    PyObject** exc;
-    PyObject** base;                        /* NULL == PyExc_StandardError */
-    char* docstr;
-    PyMethodDef* methods;
-    int (*classinit)(PyObject*);
-}
-exctable[] = {
+/* mapping between exception names and their PyObject ** */
+static struct {
+    char *name;
+    PyObject **exc;
+    PyObject **base;                        /* NULL == PyExc_StandardError */
+    char *docstr;
+    PyMethodDef *methods;
+    int (*classinit)(PyObject *);
+} exctable[] = {
  /*
   * The first three classes MUST appear in exactly this order
   */
@@ -928,18 +927,18 @@ void
 #ifdef WIN32
 __declspec(dllexport)
 #endif /* WIN32 */
-init_exceptions()
+init_exceptions(void)
 {
-    charmodulename = "exceptions";
+    char *modulename = "exceptions";
     int modnamesz = strlen(modulename);
     int i;
 
-    PyObjectme = Py_InitModule(modulename, functions);
-    PyObjectmydict = PyModule_GetDict(me);
-    PyObjectbltinmod = PyImport_ImportModule("__builtin__");
-    PyObjectbdict = PyModule_GetDict(bltinmod);
-    PyObjectdoc = PyString_FromString(module__doc__);
-    PyObjectargs;
+    PyObject *me = Py_InitModule(modulename, functions);
+    PyObject *mydict = PyModule_GetDict(me);
+    PyObject *bltinmod = PyImport_ImportModule("__builtin__");
+    PyObject *bdict = PyModule_GetDict(bltinmod);
+    PyObject *doc = PyString_FromString(module__doc__);
+    PyObject *args;
 
     PyDict_SetItemString(mydict, "__doc__", doc);
     Py_DECREF(doc);
@@ -959,8 +958,8 @@ init_exceptions()
      */
     for (i=1; exctable[i].name; i++) {
        int status;
-       charcname = PyMem_NEW(char, modnamesz+strlen(exctable[i].name)+2);
-       PyObjectbase;
+       char *cname = PyMem_NEW(char, modnamesz+strlen(exctable[i].name)+2);
+       PyObject *base;
 
        (void)strcpy(cname, modulename);
        (void)strcat(cname, ".");
@@ -1014,7 +1013,7 @@ void
 #ifdef WIN32
 __declspec(dllexport)
 #endif /* WIN32 */
-fini_exceptions()
+fini_exceptions(void)
 {
     int i;