Skip to content

Commit

Permalink
Miscelaneous ANSIfications. I'm assuming here 'main' should take (int,
Browse files Browse the repository at this point in the history
char**) and return an int even on PC platforms. If not, please fix
PC/utils/makesrc.c ;-P
  • Loading branch information
Yhg1s committed Jul 22, 2000
1 parent 23c9e00 commit 7889010
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 145 deletions.
13 changes: 5 additions & 8 deletions Demo/embed/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -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;
Expand All @@ -62,7 +59,7 @@ static PyMethodDef xyzzy_methods[] = {
};

void
initxyzzy()
initxyzzy(void)
{
PyImport_AddModule("xyzzy");
Py_InitModule("xyzzy", xyzzy_methods);
Expand Down
10 changes: 5 additions & 5 deletions Demo/pysvr/pysvr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -220,7 +220,7 @@ static PyInterpreterState *the_interp;
static PyObject *the_builtins;

static void
init_python()
init_python(void)
{
if (gtstate)
return;
Expand Down Expand Up @@ -268,7 +268,7 @@ service_thread(struct workorder *work)
}

static void
oprogname()
oprogname(void)
{
int save = errno;
fprintf(stderr, "%s: ", progname);
Expand Down Expand Up @@ -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());
Expand Down
4 changes: 1 addition & 3 deletions Include/cStringIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ typedef struct {
} dictobject;

PyObject *
PyDict_New()
PyDict_New(void)
{
register dictobject *mp;
if (dummy == NULL) { /* Auto-initialize dummy */
Expand Down
24 changes: 4 additions & 20 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ int PyUnicode_GetSize(PyObject *unicode)
return -1;
}

const char *PyUnicode_GetDefaultEncoding()
const char *PyUnicode_GetDefaultEncoding(void)
{
return unicode_default_encoding;
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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. */
Expand Down Expand Up @@ -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)
Expand All @@ -5138,7 +5122,7 @@ void _PyUnicode_Init()
/* Finalize the Unicode implementation */

void
_PyUnicode_Fini()
_PyUnicode_Fini(void)
{
PyUnicodeObject *u = unicode_freelist;

Expand Down
58 changes: 29 additions & 29 deletions PC/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {

Expand Down
5 changes: 2 additions & 3 deletions PC/example_nt/example.c
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -15,7 +14,7 @@ static PyMethodDef example_methods[] = {
};

void
initexample()
initexample(void)
{
Py_InitModule("example", example_methods);
}
4 changes: 2 additions & 2 deletions PC/frozen_dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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;
Expand Down
Loading

0 comments on commit 7889010

Please sign in to comment.