summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Schneider-Kamp <nowonder@nowonder.de>2000-07-10 12:29:26 (GMT)
committerPeter Schneider-Kamp <nowonder@nowonder.de>2000-07-10 12:29:26 (GMT)
commit41c36ffe83d22e84cc072130b3914d66d9d722f0 (patch)
tree2a0a77b79885543be54b4440c1e445d943e56a5a
parent416d413527ed7e9a1a5fe98f94487f6ee4315d2e (diff)
downloadcpython-41c36ffe83d22e84cc072130b3914d66d9d722f0.zip
cpython-41c36ffe83d22e84cc072130b3914d66d9d722f0.tar.gz
cpython-41c36ffe83d22e84cc072130b3914d66d9d722f0.tar.bz2
ANSI-fication
-rw-r--r--Modules/selectmodule.c16
-rw-r--r--Modules/sgimodule.c8
-rw-r--r--Modules/structmodule.c230
-rw-r--r--Modules/syslogmodule.c29
4 files changed, 70 insertions, 213 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 3430077..7a6dbc8 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -58,8 +58,7 @@ typedef struct {
} pylist;
static void
-reap_obj(fd2obj)
- pylist fd2obj[FD_SETSIZE + 3];
+reap_obj(pylist fd2obj[FD_SETSIZE + 3])
{
int i;
for (i = 0; i < FD_SETSIZE + 3 && fd2obj[i].sentinel >= 0; i++) {
@@ -74,10 +73,7 @@ reap_obj(fd2obj)
returns a number >= 0
*/
static int
-list2set(list, set, fd2obj)
- PyObject *list;
- fd_set *set;
- pylist fd2obj[FD_SETSIZE + 3];
+list2set(PyObject *list, fd_set *set, pylist fd2obj[FD_SETSIZE + 3])
{
int i;
int max = -1;
@@ -155,9 +151,7 @@ list2set(list, set, fd2obj)
/* returns NULL and sets the Python exception if an error occurred */
static PyObject *
-set2list(set, fd2obj)
- fd_set *set;
- pylist fd2obj[FD_SETSIZE + 3];
+set2list(fd_set *set, pylist fd2obj[FD_SETSIZE + 3])
{
int i, j, count=0;
PyObject *list, *o;
@@ -199,9 +193,7 @@ set2list(set, fd2obj)
static PyObject *
-select_select(self, args)
- PyObject *self;
- PyObject *args;
+select_select(PyObject *self, PyObject *args)
{
#ifdef MS_WINDOWS
/* This would be an awful lot of stack space on Windows! */
diff --git a/Modules/sgimodule.c b/Modules/sgimodule.c
index d0a4cc9..0f1ec9e 100644
--- a/Modules/sgimodule.c
+++ b/Modules/sgimodule.c
@@ -18,9 +18,7 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#include <fcntl.h>
static PyObject *
-sgi_nap(self, args)
- PyObject *self;
- PyObject *args;
+sgi_nap(PyObject *self, PyObject *args)
{
long ticks;
if (!PyArg_Parse(args, "l", &ticks))
@@ -35,9 +33,7 @@ sgi_nap(self, args)
extern char *_getpty(int *, int, mode_t, int);
static PyObject *
-sgi__getpty(self, args)
- PyObject *self;
- PyObject *args;
+sgi__getpty(PyObject *self, PyObject *args)
{
int oflag;
int mode;
diff --git a/Modules/structmodule.c b/Modules/structmodule.c
index fac442f..a2b4096 100644
--- a/Modules/structmodule.c
+++ b/Modules/structmodule.c
@@ -84,9 +84,7 @@ typedef struct { char c; void *x; } s_void_p;
if it isn't one */
static int
-get_long(v, p)
- PyObject *v;
- long *p;
+get_long(PyObject *v, long *p)
{
long x = PyInt_AsLong(v);
if (x == -1 && PyErr_Occurred()) {
@@ -103,9 +101,7 @@ get_long(v, p)
/* Same, but handling unsigned long */
static int
-get_ulong(v, p)
- PyObject *v;
- unsigned long *p;
+get_ulong(PyObject *v, unsigned long *p)
{
if (PyLong_Check(v)) {
unsigned long x = PyLong_AsUnsignedLong(v);
@@ -129,10 +125,9 @@ get_ulong(v, p)
/* XXX Inf/NaN are not handled quite right (but underflow is!) */
static int
-pack_float(x, p, incr)
- double x; /* The number to pack */
- char *p; /* Where to pack the high order byte */
- int incr; /* 1 for big-endian; -1 for little-endian */
+pack_float(double x, /* The number to pack */
+ char *p, /* Where to pack the high order byte */
+ int incr) /* 1 for big-endian; -1 for little-endian */
{
int s;
int e;
@@ -201,10 +196,9 @@ pack_float(x, p, incr)
}
static int
-pack_double(x, p, incr)
- double x; /* The number to pack */
- char *p; /* Where to pack the high order byte */
- int incr; /* 1 for big-endian; -1 for little-endian */
+pack_double(double x, /* The number to pack */
+ char *p, /* Where to pack the high order byte */
+ int incr) /* 1 for big-endian; -1 for little-endian */
{
int s;
int e;
@@ -294,9 +288,8 @@ pack_double(x, p, incr)
}
static PyObject *
-unpack_float(p, incr)
- char *p; /* Where the high order byte is */
- int incr; /* 1 for big-endian; -1 for little-endian */
+unpack_float(const char *p, /* Where the high order byte is */
+ int incr) /* 1 for big-endian; -1 for little-endian */
{
int s;
int e;
@@ -338,9 +331,8 @@ unpack_float(p, incr)
}
static PyObject *
-unpack_double(p, incr)
- char *p; /* Where the high order byte is */
- int incr; /* 1 for big-endian; -1 for little-endian */
+unpack_double(const char *p, /* Where the high order byte is */
+ int incr) /* 1 for big-endian; -1 for little-endian */
{
int s;
int e;
@@ -413,82 +405,62 @@ typedef struct _formatdef {
} formatdef;
static PyObject *
-nu_char(p, f)
- const char *p;
- const formatdef *f;
+nu_char(const char *p, const formatdef *f)
{
return PyString_FromStringAndSize(p, 1);
}
static PyObject *
-nu_byte(p, f)
- const char *p;
- const formatdef *f;
+nu_byte(const char *p, const formatdef *f)
{
return PyInt_FromLong((long) *(signed char *)p);
}
static PyObject *
-nu_ubyte(p, f)
- const char *p;
- const formatdef *f;
+nu_ubyte(const char *p, const formatdef *f)
{
return PyInt_FromLong((long) *(unsigned char *)p);
}
static PyObject *
-nu_short(p, f)
- const char *p;
- const formatdef *f;
+nu_short(const char *p, const formatdef *f)
{
return PyInt_FromLong((long) *(short *)p);
}
static PyObject *
-nu_ushort(p, f)
- const char *p;
- const formatdef *f;
+nu_ushort(const char *p, const formatdef *f)
{
return PyInt_FromLong((long) *(unsigned short *)p);
}
static PyObject *
-nu_int(p, f)
- const char *p;
- const formatdef *f;
+nu_int(const char *p, const formatdef *f)
{
return PyInt_FromLong((long) *(int *)p);
}
static PyObject *
-nu_uint(p, f)
- const char *p;
- const formatdef *f;
+nu_uint(const char *p, const formatdef *f)
{
unsigned int x = *(unsigned int *)p;
return PyLong_FromUnsignedLong((unsigned long)x);
}
static PyObject *
-nu_long(p, f)
- const char *p;
- const formatdef *f;
+nu_long(const char *p, const formatdef *f)
{
return PyInt_FromLong(*(long *)p);
}
static PyObject *
-nu_ulong(p, f)
- const char *p;
- const formatdef *f;
+nu_ulong(const char *p, const formatdef *f)
{
return PyLong_FromUnsignedLong(*(unsigned long *)p);
}
static PyObject *
-nu_float(p, f)
- const char *p;
- const formatdef *f;
+nu_float(const char *p, const formatdef *f)
{
float x;
memcpy((char *)&x, p, sizeof(float));
@@ -496,9 +468,7 @@ nu_float(p, f)
}
static PyObject *
-nu_double(p, f)
- const char *p;
- const formatdef *f;
+nu_double(const char *p, const formatdef *f)
{
double x;
memcpy((char *)&x, p, sizeof(double));
@@ -506,18 +476,13 @@ nu_double(p, f)
}
static PyObject *
-nu_void_p(p, f)
- const char *p;
- const formatdef *f;
+nu_void_p(const char *p, const formatdef *f)
{
return PyLong_FromVoidPtr(*(void **)p);
}
static int
-np_byte(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+np_byte(char *p, PyObject *v, const formatdef *f)
{
long x;
if (get_long(v, &x) < 0)
@@ -527,10 +492,7 @@ np_byte(p, v, f)
}
static int
-np_char(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+np_char(char *p, PyObject *v, const formatdef *f)
{
if (!PyString_Check(v) || PyString_Size(v) != 1) {
PyErr_SetString(StructError,
@@ -542,10 +504,7 @@ np_char(p, v, f)
}
static int
-np_short(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+np_short(char *p, PyObject *v, const formatdef *f)
{
long x;
if (get_long(v, &x) < 0)
@@ -555,10 +514,7 @@ np_short(p, v, f)
}
static int
-np_int(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+np_int(char *p, PyObject *v, const formatdef *f)
{
long x;
if (get_long(v, &x) < 0)
@@ -568,10 +524,7 @@ np_int(p, v, f)
}
static int
-np_uint(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+np_uint(char *p, PyObject *v, const formatdef *f)
{
unsigned long x;
if (get_ulong(v, &x) < 0)
@@ -581,10 +534,7 @@ np_uint(p, v, f)
}
static int
-np_long(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+np_long(char *p, PyObject *v, const formatdef *f)
{
long x;
if (get_long(v, &x) < 0)
@@ -594,10 +544,7 @@ np_long(p, v, f)
}
static int
-np_ulong(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+np_ulong(char *p, PyObject *v, const formatdef *f)
{
unsigned long x;
if (get_ulong(v, &x) < 0)
@@ -607,10 +554,7 @@ np_ulong(p, v, f)
}
static int
-np_float(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+np_float(char *p, PyObject *v, const formatdef *f)
{
float x = (float)PyFloat_AsDouble(v);
if (x == -1 && PyErr_Occurred()) {
@@ -623,10 +567,7 @@ np_float(p, v, f)
}
static int
-np_double(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+np_double(char *p, PyObject *v, const formatdef *f)
{
double x = PyFloat_AsDouble(v);
if (x == -1 && PyErr_Occurred()) {
@@ -639,10 +580,7 @@ np_double(p, v, f)
}
static int
-np_void_p(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+np_void_p(char *p, PyObject *v, const formatdef *f)
{
void *x = PyLong_AsVoidPtr(v);
if (x == NULL && PyErr_Occurred()) {
@@ -676,9 +614,7 @@ static formatdef native_table[] = {
};
static PyObject *
-bu_int(p, f)
- const char *p;
- const formatdef *f;
+bu_int(const char *p, const formatdef *f)
{
long x = 0;
int i = f->size;
@@ -694,9 +630,7 @@ bu_int(p, f)
}
static PyObject *
-bu_uint(p, f)
- const char *p;
- const formatdef *f;
+bu_uint(const char *p, const formatdef *f)
{
unsigned long x = 0;
int i = f->size;
@@ -710,26 +644,19 @@ bu_uint(p, f)
}
static PyObject *
-bu_float(p, f)
- const char *p;
- const formatdef *f;
+bu_float(const char *p, const formatdef *f)
{
return unpack_float(p, 1);
}
static PyObject *
-bu_double(p, f)
- const char *p;
- const formatdef *f;
+bu_double(const char *p, const formatdef *f)
{
return unpack_double(p, 1);
}
static int
-bp_int(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+bp_int(char *p, PyObject *v, const formatdef *f)
{
long x;
int i;
@@ -744,10 +671,7 @@ bp_int(p, v, f)
}
static int
-bp_uint(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+bp_uint(char *p, PyObject *v, const formatdef *f)
{
unsigned long x;
int i;
@@ -762,10 +686,7 @@ bp_uint(p, v, f)
}
static int
-bp_float(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+bp_float(char *p, PyObject *v, const formatdef *f)
{
double x = PyFloat_AsDouble(v);
if (x == -1 && PyErr_Occurred()) {
@@ -777,10 +698,7 @@ bp_float(p, v, f)
}
static int
-bp_double(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+bp_double(char *p, PyObject *v, const formatdef *f)
{
double x = PyFloat_AsDouble(v);
if (x == -1 && PyErr_Occurred()) {
@@ -810,9 +728,7 @@ static formatdef bigendian_table[] = {
};
static PyObject *
-lu_int(p, f)
- const char *p;
- const formatdef *f;
+lu_int(const char *p, const formatdef *f)
{
long x = 0;
int i = f->size;
@@ -828,9 +744,7 @@ lu_int(p, f)
}
static PyObject *
-lu_uint(p, f)
- const char *p;
- const formatdef *f;
+lu_uint(const char *p, const formatdef *f)
{
unsigned long x = 0;
int i = f->size;
@@ -844,26 +758,19 @@ lu_uint(p, f)
}
static PyObject *
-lu_float(p, f)
- const char *p;
- const formatdef *f;
+lu_float(const char *p, const formatdef *f)
{
return unpack_float(p+3, -1);
}
static PyObject *
-lu_double(p, f)
- const char *p;
- const formatdef *f;
+lu_double(const char *p, const formatdef *f)
{
return unpack_double(p+7, -1);
}
static int
-lp_int(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+lp_int(char *p, PyObject *v, const formatdef *f)
{
long x;
int i;
@@ -878,10 +785,7 @@ lp_int(p, v, f)
}
static int
-lp_uint(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+lp_uint(char *p, PyObject *v, const formatdef *f)
{
unsigned long x;
int i;
@@ -896,10 +800,7 @@ lp_uint(p, v, f)
}
static int
-lp_float(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+lp_float(char *p, PyObject *v, const formatdef *f)
{
double x = PyFloat_AsDouble(v);
if (x == -1 && PyErr_Occurred()) {
@@ -911,10 +812,7 @@ lp_float(p, v, f)
}
static int
-lp_double(p, v, f)
- char *p;
- PyObject *v;
- const formatdef *f;
+lp_double(char *p, PyObject *v, const formatdef *f)
{
double x = PyFloat_AsDouble(v);
if (x == -1 && PyErr_Occurred()) {
@@ -945,8 +843,7 @@ static formatdef lilendian_table[] = {
static const formatdef *
-whichtable(pfmt)
- const char **pfmt;
+whichtable(char **pfmt)
{
const char *fmt = (*pfmt)++; /* May be backed out of later */
switch (*fmt) {
@@ -975,9 +872,7 @@ whichtable(pfmt)
/* Get the table entry for a format code */
static const formatdef *
-getentry(c, f)
- int c;
- const formatdef *f;
+getentry(int c, const formatdef *f)
{
for (; f->format != '\0'; f++) {
if (f->format == c) {
@@ -992,10 +887,7 @@ getentry(c, f)
/* Align a size according to a format code */
static int
-align(size, c, e)
- int size;
- int c;
- const formatdef *e;
+align(int size, int c, const formatdef *e)
{
if (e->format == c) {
if (e->alignment) {
@@ -1011,9 +903,7 @@ align(size, c, e)
/* calculate the size of a format string */
static int
-calcsize(fmt, f)
- const char *fmt;
- const formatdef *f;
+calcsize(const char *fmt, const formatdef *f)
{
const formatdef *e;
const char *s;
@@ -1067,9 +957,7 @@ Return size of C struct described by format string fmt.\n\
See struct.__doc__ for more on format strings.";
static PyObject *
-struct_calcsize(self, args)
- PyObject *self; /* Not used */
- PyObject *args;
+struct_calcsize(PyObject *self, PyObject *args)
{
char *fmt;
const formatdef *f;
@@ -1091,9 +979,7 @@ Return string containing values v1, v2, ... packed according to fmt.\n\
See struct.__doc__ for more on format strings.";
static PyObject *
-struct_pack(self, args)
- PyObject *self; /* Not used */
- PyObject *args;
+struct_pack(PyObject *self, PyObject *args)
{
const formatdef *f, *e;
PyObject *format, *result, *v;
@@ -1231,9 +1117,7 @@ to fmt. Requires len(string)==calcsize(fmt).\n\
See struct.__doc__ for more on format strings.";
static PyObject *
-struct_unpack(self, args)
- PyObject *self; /* Not used */
- PyObject *args;
+struct_unpack(PyObject *self, PyObject *args)
{
const formatdef *f, *e;
char *str, *start, *fmt, *s;
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c
index 6f192c3..a9891c4 100644
--- a/Modules/syslogmodule.c
+++ b/Modules/syslogmodule.c
@@ -53,9 +53,7 @@ static PyObject *S_ident_o = NULL; /* identifier, held by openlog() */
static PyObject *
-syslog_openlog(self, args)
- PyObject * self;
- PyObject * args;
+syslog_openlog(PyObject * self, PyObject * args)
{
long logopt = 0;
long facility = LOG_USER;
@@ -80,9 +78,7 @@ syslog_openlog(self, args)
static PyObject *
-syslog_syslog(self, args)
- PyObject * self;
- PyObject * args;
+syslog_syslog(PyObject * self, PyObject * args)
{
char *message;
int priority = LOG_INFO;
@@ -101,9 +97,7 @@ syslog_syslog(self, args)
}
static PyObject *
-syslog_closelog(self, args)
- PyObject * self;
- PyObject * args;
+syslog_closelog(PyObject *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ":closelog"))
return NULL;
@@ -115,9 +109,7 @@ syslog_closelog(self, args)
}
static PyObject *
-syslog_setlogmask(self, args)
- PyObject * self;
- PyObject * args;
+syslog_setlogmask(PyObject *self, PyObject *args)
{
long maskpri, omaskpri;
@@ -128,9 +120,7 @@ syslog_setlogmask(self, args)
}
static PyObject *
-syslog_log_mask(self, args)
- PyObject * self;
- PyObject * args;
+syslog_log_mask(PyObject *self, PyObject *args)
{
long mask;
long pri;
@@ -141,9 +131,7 @@ syslog_log_mask(self, args)
}
static PyObject *
-syslog_log_upto(self, args)
- PyObject * self;
- PyObject * args;
+syslog_log_upto(PyObject *self, PyObject *args)
{
long mask;
long pri;
@@ -168,10 +156,7 @@ static PyMethodDef syslog_methods[] = {
/* helper function for initialization function */
static void
-ins(d, s, x)
- PyObject *d;
- char *s;
- long x;
+ins(PyObject *d, char *s, long x)
{
PyObject *v = PyInt_FromLong(x);
if (v) {