diff options
author | Brett Cannon <bcannon@gmail.com> | 2004-06-29 03:48:23 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2004-06-29 03:48:23 (GMT) |
commit | 289e4cba1cce7e20638d5519355b5b162a2a74af (patch) | |
tree | e5070e3dbd9c70a40931848bd3f9a7fea51e3f40 /Doc/ext/extending.tex | |
parent | 93d1b2c93ce210bb3ac69a04006a46641b5730ab (diff) | |
download | cpython-289e4cba1cce7e20638d5519355b5b162a2a74af.zip cpython-289e4cba1cce7e20638d5519355b5b162a2a74af.tar.gz cpython-289e4cba1cce7e20638d5519355b5b162a2a74af.tar.bz2 |
Changed applicable use of ``char *`` declarations that are passed into
PyArg_ParseTuple() to ``const char *`` to match the recommendation made in
section 1.3 and to support better coding habits.
Section 1.8 ("Keyword Parameters for Extension Functions") and it's coding
example were not touched since it is stems from an accredited source and thus
did not want to step on anyone's toes.
Diffstat (limited to 'Doc/ext/extending.tex')
-rw-r--r-- | Doc/ext/extending.tex | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/ext/extending.tex b/Doc/ext/extending.tex index c3d3ab0..8c9769a 100644 --- a/Doc/ext/extending.tex +++ b/Doc/ext/extending.tex @@ -70,7 +70,7 @@ is evaluated (we'll see shortly how it ends up being called): static PyObject * spam_system(PyObject *self, PyObject *args) { - char *command; + const char *command; int sts; if (!PyArg_ParseTuple(args, "s", &command)) @@ -634,7 +634,7 @@ Some example calls: int ok; int i, j; long k, l; - char *s; + const char *s; int size; ok = PyArg_ParseTuple(args, ""); /* No arguments */ @@ -659,8 +659,8 @@ Some example calls: \begin{verbatim} { - char *file; - char *mode = "r"; + const char *file; + const char *mode = "r"; int bufsize = 0; ok = PyArg_ParseTuple(args, "s|si", &file, &mode, &bufsize); /* A string, and optionally another string and an integer */ @@ -1228,7 +1228,7 @@ declared \keyword{static} like everything else: \begin{verbatim} static int -PySpam_System(char *command) +PySpam_System(const char *command) { return system(command); } @@ -1240,7 +1240,7 @@ The function \cfunction{spam_system()} is modified in a trivial way: static PyObject * spam_system(PyObject *self, PyObject *args) { - char *command; + const char *command; int sts; if (!PyArg_ParseTuple(args, "s", &command)) |