Skip to content

Commit 54aff9f

Browse files
author
twouters
committed
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 git-svn-id: http://svn.python.org/projects/python/trunk@16423 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent c578c3e commit 54aff9f

14 files changed

Lines changed: 109 additions & 145 deletions

File tree

Demo/embed/demo.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
#include "Python.h"
44

5-
void initxyzzy(); /* Forward */
5+
void initxyzzy(void); /* Forward */
66

7-
main(argc, argv)
8-
int argc;
9-
char **argv;
7+
main(int argc, char **argv)
108
{
119
/* Pass argv[0] to the Python interpreter */
1210
Py_SetProgramName(argv[0]);
@@ -46,10 +44,9 @@ main(argc, argv)
4644

4745
/* A static module */
4846

47+
/* 'self' is not used */
4948
static PyObject *
50-
xyzzy_foo(self, args)
51-
PyObject *self; /* Not used */
52-
PyObject *args;
49+
xyzzy_foo(PyObject *self, PyObjecT *args)
5350
{
5451
if (!PyArg_ParseTuple(args, ""))
5552
return NULL;
@@ -62,7 +59,7 @@ static PyMethodDef xyzzy_methods[] = {
6259
};
6360

6461
void
65-
initxyzzy()
62+
initxyzzy(void)
6663
{
6764
PyImport_AddModule("xyzzy");
6865
Py_InitModule("xyzzy", xyzzy_methods);

Demo/pysvr/pysvr.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extern int Py_VerboseFlag;
3434

3535
extern int optind;
3636
extern char *optarg;
37-
extern int getopt();
37+
extern int getopt(int, char **, char *);
3838

3939
struct workorder {
4040
int conn;
@@ -97,7 +97,7 @@ main(int argc, char **argv)
9797
static char usage_line[] = "usage: %s [port]\n";
9898

9999
static void
100-
usage()
100+
usage(void)
101101
{
102102
fprintf(stderr, usage_line, progname);
103103
exit(2);
@@ -220,7 +220,7 @@ static PyInterpreterState *the_interp;
220220
static PyObject *the_builtins;
221221

222222
static void
223-
init_python()
223+
init_python(void)
224224
{
225225
if (gtstate)
226226
return;
@@ -268,7 +268,7 @@ service_thread(struct workorder *work)
268268
}
269269

270270
static void
271-
oprogname()
271+
oprogname(void)
272272
{
273273
int save = errno;
274274
fprintf(stderr, "%s: ", progname);
@@ -364,7 +364,7 @@ run_command(char *buffer, PyObject *globals)
364364
}
365365

366366
static void
367-
ps()
367+
ps(void)
368368
{
369369
char buffer[100];
370370
sprintf(buffer, "ps -l -p %d </dev/null | tail +2l\n", getpid());

Include/cStringIO.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ static struct PycStringIO_CAPI {
107107
((O)->ob_type==PycStringIO->OutputType)
108108

109109
static void *
110-
xxxPyCObject_Import(module_name, name)
111-
char *module_name;
112-
char *name;
110+
xxxPyCObject_Import(char *module_name, char *name)
113111
{
114112
PyObject *m, *c;
115113
void *r=NULL;

Objects/dictobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ typedef struct {
9292
} dictobject;
9393

9494
PyObject *
95-
PyDict_New()
95+
PyDict_New(void)
9696
{
9797
register dictobject *mp;
9898
if (dummy == NULL) { /* Auto-initialize dummy */

Objects/unicodeobject.c

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ int PyUnicode_GetSize(PyObject *unicode)
554554
return -1;
555555
}
556556

557-
const char *PyUnicode_GetDefaultEncoding()
557+
const char *PyUnicode_GetDefaultEncoding(void)
558558
{
559559
return unicode_default_encoding;
560560
}
@@ -4530,10 +4530,7 @@ unicode_buffer_getcharbuf(PyUnicodeObject *self,
45304530
/* Helpers for PyUnicode_Format() */
45314531

45324532
static PyObject *
4533-
getnextarg(args, arglen, p_argidx)
4534-
PyObject *args;
4535-
int arglen;
4536-
int *p_argidx;
4533+
getnextarg(PyObject *args, int arglen, int *p_argidx)
45374534
{
45384535
int argidx = *p_argidx;
45394536
if (argidx < arglen) {
@@ -4555,26 +4552,13 @@ int *p_argidx;
45554552
#define F_ZERO (1<<4)
45564553

45574554
static
4558-
#ifdef HAVE_STDARG_PROTOTYPES
45594555
int usprintf(register Py_UNICODE *buffer, char *format, ...)
4560-
#else
4561-
int usprintf(va_alist) va_dcl
4562-
#endif
45634556
{
45644557
register int i;
45654558
int len;
45664559
va_list va;
45674560
char *charbuffer;
4568-
#ifdef HAVE_STDARG_PROTOTYPES
45694561
va_start(va, format);
4570-
#else
4571-
Py_UNICODE *args;
4572-
char *format;
4573-
4574-
va_start(va);
4575-
buffer = va_arg(va, Py_UNICODE *);
4576-
format = va_arg(va, char *);
4577-
#endif
45784562

45794563
/* First, format the string as char array, then expand to Py_UNICODE
45804564
array. */
@@ -5121,7 +5105,7 @@ PyTypeObject PyUnicode_Type = {
51215105

51225106
/* Initialize the Unicode implementation */
51235107

5124-
void _PyUnicode_Init()
5108+
void _PyUnicode_Init(void)
51255109
{
51265110
/* Doublecheck the configuration... */
51275111
if (sizeof(Py_UNICODE) != 2)
@@ -5138,7 +5122,7 @@ void _PyUnicode_Init()
51385122
/* Finalize the Unicode implementation */
51395123

51405124
void
5141-
_PyUnicode_Fini()
5125+
_PyUnicode_Fini(void)
51425126
{
51435127
PyUnicodeObject *u = unicode_freelist;
51445128

PC/config.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,48 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
1515

1616
#include "Python.h"
1717

18-
extern void initarray();
18+
extern void initarray(void);
1919
#ifndef MS_WIN64
20-
extern void initaudioop();
21-
extern void initbinascii();
20+
extern void initaudioop(void);
21+
extern void initbinascii(void);
2222
#endif
23-
extern void initcmath();
24-
extern void initerrno();
23+
extern void initcmath(void);
24+
extern void initerrno(void);
2525
#ifdef WITH_CYCLE_GC
26-
extern void initgc();
26+
extern void initgc(void);
2727
#endif
2828
#ifndef MS_WIN64
29-
extern void initimageop();
29+
extern void initimageop(void);
3030
#endif
31-
extern void initmath();
32-
extern void initmd5();
33-
extern void initnew();
34-
extern void initnt();
35-
extern void initoperator();
36-
extern void initregex();
31+
extern void initmath(void);
32+
extern void initmd5(void);
33+
extern void initnew(void);
34+
extern void initnt(void);
35+
extern void initoperator(void);
36+
extern void initregex(void);
3737
#ifndef MS_WIN64
38-
extern void initrgbimg();
38+
extern void initrgbimg(void);
3939
#endif
40-
extern void initrotor();
41-
extern void initsignal();
42-
extern void initsha();
43-
extern void initstrop();
44-
extern void initstruct();
45-
extern void inittime();
46-
extern void initthread();
47-
extern void initcStringIO();
48-
extern void initcPickle();
49-
extern void initpcre();
40+
extern void initrotor(void);
41+
extern void initsignal(void);
42+
extern void initsha(void);
43+
extern void initstrop(void);
44+
extern void initstruct(void);
45+
extern void inittime(void);
46+
extern void initthread(void);
47+
extern void initcStringIO(void);
48+
extern void initcPickle(void);
49+
extern void initpcre(void);
5050
#ifdef WIN32
51-
extern void initmsvcrt();
52-
extern void init_locale();
51+
extern void initmsvcrt(void);
52+
extern void init_locale(void);
5353
#endif
54-
extern void init_codecs();
54+
extern void init_codecs(void);
5555

5656
/* -- ADDMODULE MARKER 1 -- */
5757

58-
extern void PyMarshal_Init();
59-
extern void initimp();
58+
extern void PyMarshal_Init(void);
59+
extern void initimp(void);
6060

6161
struct _inittab _PyImport_Inittab[] = {
6262

PC/example_nt/example.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#include "Python.h"
22

33
static PyObject *
4-
ex_foo(self, args)
5-
PyObject *self, *args;
4+
ex_foo(PyObject *self, PyObject *args)
65
{
76
printf("Hello, world\n");
87
Py_INCREF(Py_None);
@@ -15,7 +14,7 @@ static PyMethodDef example_methods[] = {
1514
};
1615

1716
void
18-
initexample()
17+
initexample(void)
1918
{
2019
Py_InitModule("example", example_methods);
2120
}

PC/frozen_dllmain.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ BOOL CallModuleDllMain(char *modName, DWORD dwReason);
6060
Called by a frozen .EXE only, so that built-in extension
6161
modules are initialized correctly
6262
*/
63-
void PyWinFreeze_ExeInit()
63+
void PyWinFreeze_ExeInit(void)
6464
{
6565
char **modName;
6666
for (modName = possibleModules;*modName;*modName++) {
@@ -73,7 +73,7 @@ void PyWinFreeze_ExeInit()
7373
Called by a frozen .EXE only, so that built-in extension
7474
modules are cleaned up
7575
*/
76-
void PyWinFreeze_ExeTerm()
76+
void PyWinFreeze_ExeTerm(void)
7777
{
7878
// Must go backwards
7979
char **modName;

0 commit comments

Comments
 (0)