Convert the example C code to ANSI rather than K&R.
This matches the Python C style guide (PEP 7).
Closes SF patch #571489.
diff --git a/Doc/ext/extending.tex b/Doc/ext/extending.tex
index 9b6517a..60de586 100644
--- a/Doc/ext/extending.tex
+++ b/Doc/ext/extending.tex
@@ -65,9 +65,7 @@
\begin{verbatim}
static PyObject *
-spam_system(self, args)
- PyObject *self;
- PyObject *args;
+spam_system(PyObject *self, PyObject *args)
{
char *command;
int sts;
@@ -371,7 +369,8 @@
\cfunction{Py_Initialize()} or \cfunction{PyMac_Initialize()}:
\begin{verbatim}
-int main(int argc, char **argv)
+int
+main(int argc, char *argv[])
{
/* Pass argv[0] to the Python interpreter */
Py_SetProgramName(argv[0]);
@@ -476,8 +475,7 @@
static PyObject *my_callback = NULL;
static PyObject *
-my_set_callback(dummy, args)
- PyObject *dummy, *args;
+my_set_callback(PyObject *dummy, PyObject *args)
{
PyObject *result = NULL;
PyObject *temp;
@@ -696,7 +694,7 @@
\begin{verbatim}
int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,
- char *format, char **kwlist, ...);
+ char *format, char *kwlist[], ...);
\end{verbatim}
The \var{arg} and \var{format} parameters are identical to those of the
@@ -720,10 +718,7 @@
#include "Python.h"
static PyObject *
-keywdarg_parrot(self, args, keywds)
- PyObject *self;
- PyObject *args;
- PyObject *keywds;
+keywdarg_parrot(PyObject *self, PyObject *args, PyObject *keywds)
{
int voltage;
char *state = "a stiff";
@@ -1018,7 +1013,9 @@
reference to a list item. For instance:
\begin{verbatim}
-bug(PyObject *list) {
+void
+bug(PyObject *list)
+{
PyObject *item = PyList_GetItem(list, 0);
PyList_SetItem(list, 1, PyInt_FromLong(0L));
@@ -1052,7 +1049,9 @@
function reads:
\begin{verbatim}
-no_bug(PyObject *list) {
+void
+no_bug(PyObject *list)
+{
PyObject *item = PyList_GetItem(list, 0);
Py_INCREF(item);
@@ -1078,7 +1077,9 @@
problem as the previous one:
\begin{verbatim}
-bug(PyObject *list) {
+void
+bug(PyObject *list)
+{
PyObject *item = PyList_GetItem(list, 0);
Py_BEGIN_ALLOW_THREADS
...some blocking I/O call...
@@ -1221,8 +1222,7 @@
\begin{verbatim}
static int
-PySpam_System(command)
- char *command;
+PySpam_System(char *command)
{
return system(command);
}
@@ -1232,9 +1232,7 @@
\begin{verbatim}
static PyObject *
-spam_system(self, args)
- PyObject *self;
- PyObject *args;
+spam_system(PyObject *self, PyObject *args)
{
char *command;
int sts;