summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-07-22 19:25:51 (GMT)
committerThomas Wouters <thomas@python.org>2000-07-22 19:25:51 (GMT)
commit7889010731eec703eda68fb32b6805c65e3f1cbf (patch)
tree2ef252eeade1d3aae02fc8b881c9e6a0c5bb1e42
parent23c9e0024af99379ae517b016b874d57127e9a97 (diff)
downloadcpython-7889010731eec703eda68fb32b6805c65e3f1cbf.zip
cpython-7889010731eec703eda68fb32b6805c65e3f1cbf.tar.gz
cpython-7889010731eec703eda68fb32b6805c65e3f1cbf.tar.bz2
Miscelaneous ANSIfications. I'm assuming here 'main' should take (int,
char**) and return an int even on PC platforms. If not, please fix PC/utils/makesrc.c ;-P
-rw-r--r--Demo/embed/demo.c13
-rw-r--r--Demo/pysvr/pysvr.c10
-rw-r--r--Include/cStringIO.h4
-rw-r--r--Objects/dictobject.c2
-rw-r--r--Objects/unicodeobject.c24
-rw-r--r--PC/config.c58
-rw-r--r--PC/example_nt/example.c5
-rw-r--r--PC/frozen_dllmain.c4
-rw-r--r--PC/getpathp.c35
-rw-r--r--PC/os2vacpp/config.c60
-rw-r--r--PC/os2vacpp/getpathp.c29
-rwxr-xr-xPC/utils/makesrc.c6
-rw-r--r--PC/winsound.c2
-rw-r--r--Tools/perfecthash/perfhash.c2
14 files changed, 109 insertions, 145 deletions
diff --git a/Demo/embed/demo.c b/Demo/embed/demo.c
index 579ba07..26df355 100644
--- a/Demo/embed/demo.c
+++ b/Demo/embed/demo.c
@@ -2,11 +2,9 @@
#include "Python.h"
-void initxyzzy(); /* Forward */
+void initxyzzy(void); /* Forward */
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
/* Pass argv[0] to the Python interpreter */
Py_SetProgramName(argv[0]);
@@ -46,10 +44,9 @@ main(argc, argv)
/* A static module */
+/* 'self' is not used */
static PyObject *
-xyzzy_foo(self, args)
- PyObject *self; /* Not used */
- PyObject *args;
+xyzzy_foo(PyObject *self, PyObjecT *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
@@ -62,7 +59,7 @@ static PyMethodDef xyzzy_methods[] = {
};
void
-initxyzzy()
+initxyzzy(void)
{
PyImport_AddModule("xyzzy");
Py_InitModule("xyzzy", xyzzy_methods);
diff --git a/Demo/pysvr/pysvr.c b/Demo/pysvr/pysvr.c
index 995a7ca..d7d755c 100644
--- a/Demo/pysvr/pysvr.c
+++ b/Demo/pysvr/pysvr.c
@@ -34,7 +34,7 @@ extern int Py_VerboseFlag;
extern int optind;
extern char *optarg;
-extern int getopt();
+extern int getopt(int, char **, char *);
struct workorder {
int conn;
@@ -97,7 +97,7 @@ main(int argc, char **argv)
static char usage_line[] = "usage: %s [port]\n";
static void
-usage()
+usage(void)
{
fprintf(stderr, usage_line, progname);
exit(2);
@@ -220,7 +220,7 @@ static PyInterpreterState *the_interp;
static PyObject *the_builtins;
static void
-init_python()
+init_python(void)
{
if (gtstate)
return;
@@ -268,7 +268,7 @@ service_thread(struct workorder *work)
}
static void
-oprogname()
+oprogname(void)
{
int save = errno;
fprintf(stderr, "%s: ", progname);
@@ -364,7 +364,7 @@ run_command(char *buffer, PyObject *globals)
}
static void
-ps()
+ps(void)
{
char buffer[100];
sprintf(buffer, "ps -l -p %d </dev/null | tail +2l\n", getpid());
diff --git a/Include/cStringIO.h b/Include/cStringIO.h
index fac5f05..8aff2e3 100644
--- a/Include/cStringIO.h
+++ b/Include/cStringIO.h
@@ -107,9 +107,7 @@ static struct PycStringIO_CAPI {
((O)->ob_type==PycStringIO->OutputType)
static void *
-xxxPyCObject_Import(module_name, name)
- char *module_name;
- char *name;
+xxxPyCObject_Import(char *module_name, char *name)
{
PyObject *m, *c;
void *r=NULL;
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 819fadd..4fafb8a 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -92,7 +92,7 @@ typedef struct {
} dictobject;
PyObject *
-PyDict_New()
+PyDict_New(void)
{
register dictobject *mp;
if (dummy == NULL) { /* Auto-initialize dummy */
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index c904710..359a987 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -554,7 +554,7 @@ int PyUnicode_GetSize(PyObject *unicode)
return -1;
}
-const char *PyUnicode_GetDefaultEncoding()
+const char *PyUnicode_GetDefaultEncoding(void)
{
return unicode_default_encoding;
}
@@ -4530,10 +4530,7 @@ unicode_buffer_getcharbuf(PyUnicodeObject *self,
/* Helpers for PyUnicode_Format() */
static PyObject *
-getnextarg(args, arglen, p_argidx)
- PyObject *args;
-int arglen;
-int *p_argidx;
+getnextarg(PyObject *args, int arglen, int *p_argidx)
{
int argidx = *p_argidx;
if (argidx < arglen) {
@@ -4555,26 +4552,13 @@ int *p_argidx;
#define F_ZERO (1<<4)
static
-#ifdef HAVE_STDARG_PROTOTYPES
int usprintf(register Py_UNICODE *buffer, char *format, ...)
-#else
-int usprintf(va_alist) va_dcl
-#endif
{
register int i;
int len;
va_list va;
char *charbuffer;
-#ifdef HAVE_STDARG_PROTOTYPES
va_start(va, format);
-#else
- Py_UNICODE *args;
- char *format;
-
- va_start(va);
- buffer = va_arg(va, Py_UNICODE *);
- format = va_arg(va, char *);
-#endif
/* First, format the string as char array, then expand to Py_UNICODE
array. */
@@ -5121,7 +5105,7 @@ PyTypeObject PyUnicode_Type = {
/* Initialize the Unicode implementation */
-void _PyUnicode_Init()
+void _PyUnicode_Init(void)
{
/* Doublecheck the configuration... */
if (sizeof(Py_UNICODE) != 2)
@@ -5138,7 +5122,7 @@ void _PyUnicode_Init()
/* Finalize the Unicode implementation */
void
-_PyUnicode_Fini()
+_PyUnicode_Fini(void)
{
PyUnicodeObject *u = unicode_freelist;
diff --git a/PC/config.c b/PC/config.c
index d9d9187..d71b669 100644
--- a/PC/config.c
+++ b/PC/config.c
@@ -15,48 +15,48 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include "Python.h"
-extern void initarray();
+extern void initarray(void);
#ifndef MS_WIN64
-extern void initaudioop();
-extern void initbinascii();
+extern void initaudioop(void);
+extern void initbinascii(void);
#endif
-extern void initcmath();
-extern void initerrno();
+extern void initcmath(void);
+extern void initerrno(void);
#ifdef WITH_CYCLE_GC
-extern void initgc();
+extern void initgc(void);
#endif
#ifndef MS_WIN64
-extern void initimageop();
+extern void initimageop(void);
#endif
-extern void initmath();
-extern void initmd5();
-extern void initnew();
-extern void initnt();
-extern void initoperator();
-extern void initregex();
+extern void initmath(void);
+extern void initmd5(void);
+extern void initnew(void);
+extern void initnt(void);
+extern void initoperator(void);
+extern void initregex(void);
#ifndef MS_WIN64
-extern void initrgbimg();
+extern void initrgbimg(void);
#endif
-extern void initrotor();
-extern void initsignal();
-extern void initsha();
-extern void initstrop();
-extern void initstruct();
-extern void inittime();
-extern void initthread();
-extern void initcStringIO();
-extern void initcPickle();
-extern void initpcre();
+extern void initrotor(void);
+extern void initsignal(void);
+extern void initsha(void);
+extern void initstrop(void);
+extern void initstruct(void);
+extern void inittime(void);
+extern void initthread(void);
+extern void initcStringIO(void);
+extern void initcPickle(void);
+extern void initpcre(void);
#ifdef WIN32
-extern void initmsvcrt();
-extern void init_locale();
+extern void initmsvcrt(void);
+extern void init_locale(void);
#endif
-extern void init_codecs();
+extern void init_codecs(void);
/* -- ADDMODULE MARKER 1 -- */
-extern void PyMarshal_Init();
-extern void initimp();
+extern void PyMarshal_Init(void);
+extern void initimp(void);
struct _inittab _PyImport_Inittab[] = {
diff --git a/PC/example_nt/example.c b/PC/example_nt/example.c
index dd8964b..63682f1 100644
--- a/PC/example_nt/example.c
+++ b/PC/example_nt/example.c
@@ -1,8 +1,7 @@
#include "Python.h"
static PyObject *
-ex_foo(self, args)
- PyObject *self, *args;
+ex_foo(PyObject *self, PyObject *args)
{
printf("Hello, world\n");
Py_INCREF(Py_None);
@@ -15,7 +14,7 @@ static PyMethodDef example_methods[] = {
};
void
-initexample()
+initexample(void)
{
Py_InitModule("example", example_methods);
}
diff --git a/PC/frozen_dllmain.c b/PC/frozen_dllmain.c
index 6ca4cd4..0873d8f 100644
--- a/PC/frozen_dllmain.c
+++ b/PC/frozen_dllmain.c
@@ -60,7 +60,7 @@ BOOL CallModuleDllMain(char *modName, DWORD dwReason);
Called by a frozen .EXE only, so that built-in extension
modules are initialized correctly
*/
-void PyWinFreeze_ExeInit()
+void PyWinFreeze_ExeInit(void)
{
char **modName;
for (modName = possibleModules;*modName;*modName++) {
@@ -73,7 +73,7 @@ void PyWinFreeze_ExeInit()
Called by a frozen .EXE only, so that built-in extension
modules are cleaned up
*/
-void PyWinFreeze_ExeTerm()
+void PyWinFreeze_ExeTerm(void)
{
// Must go backwards
char **modName;
diff --git a/PC/getpathp.c b/PC/getpathp.c
index ea388f2..e4ff136 100644
--- a/PC/getpathp.c
+++ b/PC/getpathp.c
@@ -98,8 +98,7 @@ static char *module_search_path = NULL;
static int
-is_sep(ch) /* determine if "ch" is a separator character */
- char ch;
+is_sep(char ch) /* determine if "ch" is a separator character */
{
#ifdef ALTSEP
return ch == SEP || ch == ALTSEP;
@@ -110,8 +109,7 @@ is_sep(ch) /* determine if "ch" is a separator character */
static void
-reduce(dir)
- char *dir;
+reduce(char *dir)
{
size_t i = strlen(dir);
while (i > 0 && !is_sep(dir[i]))
@@ -121,8 +119,7 @@ reduce(dir)
static int
-exists(filename)
- char *filename;
+exists(char *filename)
{
struct stat buf;
return stat(filename, &buf) == 0;
@@ -130,8 +127,7 @@ exists(filename)
static int
-ismodule(filename) /* Is module -- check for .pyc/.pyo too */
- char *filename;
+ismodule(char *filename) /* Is module -- check for .pyc/.pyo too */
{
if (exists(filename))
return 1;
@@ -147,9 +143,7 @@ ismodule(filename) /* Is module -- check for .pyc/.pyo too */
static void
-join(buffer, stuff)
- char *buffer;
- char *stuff;
+join(char *buffer, char *stuff)
{
size_t n, k;
if (is_sep(stuff[0]))
@@ -168,8 +162,7 @@ join(buffer, stuff)
static int
-gotlandmark(landmark)
- char *landmark;
+gotlandmark(char *landmark)
{
int n, ok;
@@ -182,9 +175,7 @@ gotlandmark(landmark)
static int
-search_for_prefix(argv0_path, landmark)
- char *argv0_path;
- char *landmark;
+search_for_prefix(char *argv0_path, char *landmark)
{
/* Search from argv0_path, until landmark is found */
strcpy(prefix, argv0_path);
@@ -343,7 +334,7 @@ done:
#endif /* MS_WIN32 */
static void
-get_progpath()
+get_progpath(void)
{
extern char *Py_GetProgramName();
char *path = getenv("PATH");
@@ -403,7 +394,7 @@ get_progpath()
}
static void
-calculate_path()
+calculate_path(void)
{
char argv0_path[MAXPATHLEN+1];
char *buf;
@@ -565,7 +556,7 @@ calculate_path()
/* External interface */
char *
-Py_GetPath()
+Py_GetPath(void)
{
if (!module_search_path)
calculate_path();
@@ -573,7 +564,7 @@ Py_GetPath()
}
char *
-Py_GetPrefix()
+Py_GetPrefix(void)
{
if (!module_search_path)
calculate_path();
@@ -581,13 +572,13 @@ Py_GetPrefix()
}
char *
-Py_GetExecPrefix()
+Py_GetExecPrefix(void)
{
return Py_GetPrefix();
}
char *
-Py_GetProgramFullPath()
+Py_GetProgramFullPath(void)
{
if (!module_search_path)
calculate_path();
diff --git a/PC/os2vacpp/config.c b/PC/os2vacpp/config.c
index 3b8f854..3d54e53 100644
--- a/PC/os2vacpp/config.c
+++ b/PC/os2vacpp/config.c
@@ -15,41 +15,41 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include "Python.h"
-extern void initarray();
-extern void initaudioop();
-extern void initbinascii();
-extern void initcmath();
-extern void initerrno();
-extern void initimageop();
-extern void initmath();
-extern void initmd5();
-extern void initnew();
-extern void initnt();
-extern void initos2();
-extern void initoperator();
-extern void initposix();
-extern void initregex();
-extern void initrgbimg();
-extern void initrotor();
-extern void initsignal();
-extern void initselect();
-extern void init_socket();
-extern void initsoundex();
-extern void initstrop();
-extern void initstruct();
-extern void inittime();
-extern void initthread();
-extern void initcStringIO();
-extern void initcPickle();
-extern void initpcre();
+extern void initarray(void);
+extern void initaudioop(void);
+extern void initbinascii(void);
+extern void initcmath(void);
+extern void initerrno(void);
+extern void initimageop(void);
+extern void initmath(void);
+extern void initmd5(void);
+extern void initnew(void);
+extern void initnt(void);
+extern void initos2(void);
+extern void initoperator(void);
+extern void initposix(void);
+extern void initregex(void);
+extern void initrgbimg(void);
+extern void initrotor(void);
+extern void initsignal(void);
+extern void initselect(void);
+extern void init_socket(void);
+extern void initsoundex(void);
+extern void initstrop(void);
+extern void initstruct(void);
+extern void inittime(void);
+extern void initthread(void);
+extern void initcStringIO(void);
+extern void initcPickle(void);
+extern void initpcre(void);
#ifdef WIN32
-extern void initmsvcrt();
+extern void initmsvcrt(void);
#endif
/* -- ADDMODULE MARKER 1 -- */
-extern void PyMarshal_Init();
-extern void initimp();
+extern void PyMarshal_Init(void);
+extern void initimp(void);
struct _inittab _PyImport_Inittab[] = {
diff --git a/PC/os2vacpp/getpathp.c b/PC/os2vacpp/getpathp.c
index f796851..1c78674 100644
--- a/PC/os2vacpp/getpathp.c
+++ b/PC/os2vacpp/getpathp.c
@@ -64,8 +64,7 @@ static char *module_search_path = NULL;
static int
-is_sep(ch) /* determine if "ch" is a separator character */
- char ch;
+is_sep(char ch) /* determine if "ch" is a separator character */
{
#ifdef ALTSEP
return ch == SEP || ch == ALTSEP;
@@ -76,8 +75,7 @@ is_sep(ch) /* determine if "ch" is a separator character */
static void
-reduce(dir)
- char *dir;
+reduce(char *dir)
{
int i = strlen(dir);
while (i > 0 && !is_sep(dir[i]))
@@ -87,8 +85,7 @@ reduce(dir)
static int
-exists(filename)
- char *filename;
+exists(char *filename)
{
struct stat buf;
return stat(filename, &buf) == 0;
@@ -96,9 +93,7 @@ exists(filename)
static void
-join(buffer, stuff)
- char *buffer;
- char *stuff;
+join(char *buffer, char *stuff)
{
int n, k;
if (is_sep(stuff[0]))
@@ -117,9 +112,7 @@ join(buffer, stuff)
static int
-search_for_prefix(argv0_path, landmark)
- char *argv0_path;
- char *landmark;
+search_for_prefix(char *argv0_path, char *landmark)
{
int n;
@@ -247,7 +240,7 @@ getpythonregpath(HKEY keyBase, BOOL bWin32s)
#endif /* MS_WIN32 */
static void
-get_progpath()
+get_progpath(void)
{
extern char *Py_GetProgramName();
char *path = getenv("PATH");
@@ -299,7 +292,7 @@ get_progpath()
}
static void
-calculate_path()
+calculate_path(void)
{
char argv0_path[MAXPATHLEN+1];
char *buf;
@@ -451,7 +444,7 @@ calculate_path()
/* External interface */
char *
-Py_GetPath()
+Py_GetPath(void)
{
if (!module_search_path)
calculate_path();
@@ -460,7 +453,7 @@ Py_GetPath()
}
char *
-Py_GetPrefix()
+Py_GetPrefix(void)
{
if (!module_search_path)
calculate_path();
@@ -469,7 +462,7 @@ Py_GetPrefix()
}
char *
-Py_GetExecPrefix()
+Py_GetExecPrefix(void)
{
if (!module_search_path)
calculate_path();
@@ -478,7 +471,7 @@ Py_GetExecPrefix()
}
char *
-Py_GetProgramFullPath()
+Py_GetProgramFullPath(void)
{
if (!module_search_path)
calculate_path();
diff --git a/PC/utils/makesrc.c b/PC/utils/makesrc.c
index 883b4d8..458bfab 100755
--- a/PC/utils/makesrc.c
+++ b/PC/utils/makesrc.c
@@ -7,7 +7,9 @@ file names and #include names to 8x3 lower case */
char *usage = "You must be in the \"pc\" directory.\n";
char *list[] = {"..\\Include", "..\\Modules", "..\\Objects", "..\\Parser", "..\\Python", ".", 0};
-main()
+
+int
+main(int argc, char ** argv)
{
DIR *dpath;
struct dirent *dir;
@@ -64,4 +66,4 @@ main()
closedir(dpath);
}
return 0;
- }
+}
diff --git a/PC/winsound.c b/PC/winsound.c
index 63906c9..a9c14a6 100644
--- a/PC/winsound.c
+++ b/PC/winsound.c
@@ -140,7 +140,7 @@ static void add_define(PyObject *dict, const char *key, long value)
#define ADD_DEFINE(tok) add_define(dict,#tok,tok)
DL_EXPORT(void)
-initwinsound()
+initwinsound(void)
{
PyObject *module=Py_InitModule3("winsound", sound_methods, sound_module_doc);
PyObject *dict=PyModule_GetDict(module);
diff --git a/Tools/perfecthash/perfhash.c b/Tools/perfecthash/perfhash.c
index e7ba0c7..166b183 100644
--- a/Tools/perfecthash/perfhash.c
+++ b/Tools/perfecthash/perfhash.c
@@ -61,7 +61,7 @@ static struct PyMethodDef hashMethods[] = {
#ifdef _MSC_VER
_declspec(dllexport)
#endif
-void initperfhash()
+void initperfhash(void)
{
PyObject *m;