diff options
author | Thomas Wouters <thomas@python.org> | 2000-07-22 19:25:51 +0000 |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2000-07-22 19:25:51 +0000 |
commit | 7889010731eec703eda68fb32b6805c65e3f1cbf (patch) | |
tree | 2ef252eeade1d3aae02fc8b881c9e6a0c5bb1e42 | |
parent | 23c9e0024af99379ae517b016b874d57127e9a97 (diff) | |
download | cpython-git-7889010731eec703eda68fb32b6805c65e3f1cbf.tar.gz |
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.c | 13 | ||||
-rw-r--r-- | Demo/pysvr/pysvr.c | 10 | ||||
-rw-r--r-- | Include/cStringIO.h | 4 | ||||
-rw-r--r-- | Objects/dictobject.c | 2 | ||||
-rw-r--r-- | Objects/unicodeobject.c | 24 | ||||
-rw-r--r-- | PC/config.c | 58 | ||||
-rw-r--r-- | PC/example_nt/example.c | 5 | ||||
-rw-r--r-- | PC/frozen_dllmain.c | 4 | ||||
-rw-r--r-- | PC/getpathp.c | 35 | ||||
-rw-r--r-- | PC/os2vacpp/config.c | 60 | ||||
-rw-r--r-- | PC/os2vacpp/getpathp.c | 29 | ||||
-rwxr-xr-x | PC/utils/makesrc.c | 6 | ||||
-rw-r--r-- | PC/winsound.c | 2 | ||||
-rw-r--r-- | Tools/perfecthash/perfhash.c | 2 |
14 files changed, 109 insertions, 145 deletions
diff --git a/Demo/embed/demo.c b/Demo/embed/demo.c index 579ba0706e..26df355e5c 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 995a7ca0d1..d7d755cb3c 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 fac5f05a74..8aff2e32eb 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 819fadde7a..4fafb8a963 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 c904710385..359a9872ff 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 d9d9187f85..d71b669731 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 dd8964bbb0..63682f11f0 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 6ca4cd47ac..0873d8f573 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 ea388f2a98..e4ff136ea7 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 3b8f85406b..3d54e53b3c 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 f796851493..1c78674175 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 883b4d8e70..458bfab068 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 63906c99da..a9c14a67d9 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 e7ba0c75da..166b1836d9 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; |