From a788a7f0fba47538879d7329fd340437377444f2 Mon Sep 17 00:00:00 2001 From: Peter Schneider-Kamp Date: Mon, 10 Jul 2000 09:57:19 +0000 Subject: [PATCH] ANSI-fication --- Modules/binascii.c | 45 ++++++++------------------------ Modules/cryptmodule.c | 3 +-- Modules/readline.c | 59 +++++++++++------------------------------- Modules/zlibmodule.c | 60 ++++++++++++------------------------------- 4 files changed, 43 insertions(+), 124 deletions(-) diff --git a/Modules/binascii.c b/Modules/binascii.c index 31fcde29906..fca4ca09d80 100644 --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -187,9 +187,7 @@ static unsigned short crctab_hqx[256] = { static char doc_a2b_uu[] = "(ascii) -> bin. Decode a line of uuencoded data"; static PyObject * -binascii_a2b_uu(self, args) - PyObject *self; - PyObject *args; +binascii_a2b_uu(PyObject *self, PyObject *args) { unsigned char *ascii_data, *bin_data; int leftbits = 0; @@ -264,9 +262,7 @@ binascii_a2b_uu(self, args) static char doc_b2a_uu[] = "(bin) -> ascii. Uuencode line of data"; static PyObject * -binascii_b2a_uu(self, args) - PyObject *self; - PyObject *args; +binascii_b2a_uu(PyObject *self, PyObject *args) { unsigned char *ascii_data, *bin_data; int leftbits = 0; @@ -315,10 +311,7 @@ binascii_b2a_uu(self, args) static int -binascii_find_valid(s, slen, num) - char *s; - int slen; - int num; +binascii_find_valid(unsigned char *s, int slen, int num) { /* Finds & returns the (num+1)th ** valid character for base64, or -1 if none. @@ -345,9 +338,7 @@ binascii_find_valid(s, slen, num) static char doc_a2b_base64[] = "(ascii) -> bin. Decode a line of base64 data"; static PyObject * -binascii_a2b_base64(self, args) - PyObject *self; - PyObject *args; +binascii_a2b_base64(PyObject *self, PyObject *args) { unsigned char *ascii_data, *bin_data; int leftbits = 0; @@ -430,9 +421,7 @@ binascii_a2b_base64(self, args) static char doc_b2a_base64[] = "(bin) -> ascii. Base64-code line of data"; static PyObject * -binascii_b2a_base64(self, args) - PyObject *self; - PyObject *args; +binascii_b2a_base64(PyObject *self, PyObject *args) { unsigned char *ascii_data, *bin_data; int leftbits = 0; @@ -483,9 +472,7 @@ binascii_b2a_base64(self, args) static char doc_a2b_hqx[] = "ascii -> bin, done. Decode .hqx coding"; static PyObject * -binascii_a2b_hqx(self, args) - PyObject *self; - PyObject *args; +binascii_a2b_hqx(PyObject *self, PyObject *args) { unsigned char *ascii_data, *bin_data; int leftbits = 0; @@ -549,9 +536,7 @@ binascii_a2b_hqx(self, args) static char doc_rlecode_hqx[] = "Binhex RLE-code binary data"; static PyObject * -binascii_rlecode_hqx(self, args) - PyObject *self; -PyObject *args; +binascii_rlecode_hqx(PyObject *self, PyObject *args) { unsigned char *in_data, *out_data; PyObject *rv; @@ -598,9 +583,7 @@ PyObject *args; static char doc_b2a_hqx[] = "Encode .hqx data"; static PyObject * -binascii_b2a_hqx(self, args) - PyObject *self; - PyObject *args; +binascii_b2a_hqx(PyObject *self, PyObject *args) { unsigned char *ascii_data, *bin_data; int leftbits = 0; @@ -640,9 +623,7 @@ binascii_b2a_hqx(self, args) static char doc_rledecode_hqx[] = "Decode hexbin RLE-coded string"; static PyObject * -binascii_rledecode_hqx(self, args) - PyObject *self; - PyObject *args; +binascii_rledecode_hqx(PyObject *self, PyObject *args) { unsigned char *in_data, *out_data; unsigned char in_byte, in_repeat; @@ -739,9 +720,7 @@ static char doc_crc_hqx[] = "(data, oldcrc) -> newcrc. Compute hqx CRC incrementally"; static PyObject * -binascii_crc_hqx(self, args) - PyObject *self; -PyObject *args; +binascii_crc_hqx(PyObject *self, PyObject *args) { unsigned char *bin_data; unsigned int crc; @@ -879,9 +858,7 @@ static unsigned long crc_32_tab[256] = { }; static PyObject * -binascii_crc32(self, args) - PyObject *self; - PyObject *args; +binascii_crc32(PyObject *self, PyObject *args) { /* By Jim Ahlstrom; All rights transferred to CNRI */ unsigned char *bin_data; unsigned long crc = 0UL; /* initial value of CRC */ diff --git a/Modules/cryptmodule.c b/Modules/cryptmodule.c index 746dee15928..2c043f94181 100644 --- a/Modules/cryptmodule.c +++ b/Modules/cryptmodule.c @@ -9,8 +9,7 @@ /* Module crypt */ -static PyObject *crypt_crypt(self, args) - PyObject *self, *args; +static PyObject *crypt_crypt(PyObject *self, PyObject *args) { char *word, *salt; extern char * crypt(); diff --git a/Modules/readline.c b/Modules/readline.c index 8215321837d..2986b9de7f2 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -45,9 +45,7 @@ extern char *(*PyOS_ReadlineFunctionPointer)(char *); /* Exported function to send one line to readline's init file parser */ static PyObject * -parse_and_bind(self, args) - PyObject *self; - PyObject *args; +parse_and_bind(PyObject *self, PyObject *args) { char *s, *copy; if (!PyArg_ParseTuple(args, "s:parse_and_bind", &s)) @@ -73,9 +71,7 @@ Parse and execute single line of a readline init file.\ /* Exported function to parse a readline init file */ static PyObject * -read_init_file(self, args) - PyObject *self; - PyObject *args; +read_init_file(PyObject *self, PyObject *args) { char *s = NULL; if (!PyArg_ParseTuple(args, "|z:read_init_file", &s)) @@ -97,9 +93,7 @@ The default filename is the last filename used.\ /* Exported function to load a readline history file */ static PyObject * -read_history_file(self, args) - PyObject *self; - PyObject *args; +read_history_file(PyObject *self, PyObject *args) { char *s = NULL; if (!PyArg_ParseTuple(args, "|z:read_history_file", &s)) @@ -121,9 +115,7 @@ The default filename is ~/.history.\ /* Exported function to save a readline history file */ static PyObject * -write_history_file(self, args) - PyObject *self; - PyObject *args; +write_history_file(PyObject *self, PyObject *args) { char *s = NULL; if (!PyArg_ParseTuple(args, "|z:write_history_file", &s)) @@ -152,9 +144,7 @@ static PyObject *endidx = NULL; /* get the beginning index for the scope of the tab-completion */ static PyObject * -get_begidx(self, args) - PyObject *self; - PyObject *args; +get_begidx(PyObject *self, PyObject *args) { if(!PyArg_NoArgs(args)) { return NULL; @@ -169,9 +159,7 @@ get the beginning index of the readline tab-completion scope"; /* get the ending index for the scope of the tab-completion */ static PyObject * -get_endidx(self, args) - PyObject *self; - PyObject *args; +get_endidx(PyObject *self, PyObject *args) { if(!PyArg_NoArgs(args)) { return NULL; @@ -188,9 +176,7 @@ get the ending index of the readline tab-completion scope"; /* set the tab-completion word-delimiters that readline uses */ static PyObject * -set_completer_delims(self, args) - PyObject *self; - PyObject *args; +set_completer_delims(PyObject *self, PyObject *args) { char *break_chars; @@ -211,9 +197,7 @@ set the readline word delimiters for tab-completion"; /* get the tab-completion word-delimiters that readline uses */ static PyObject * -get_completer_delims(self, args) - PyObject *self; - PyObject *args; +get_completer_delims(PyObject *self, PyObject *args) { if(!PyArg_NoArgs(args)) { return NULL; @@ -226,9 +210,7 @@ get_completer_delims() -> string\n\ get the readline word delimiters for tab-completion"; static PyObject * -set_completer(self, args) - PyObject *self; - PyObject *args; +set_completer(PyObject *self, PyObject *args) { PyObject *function = Py_None; if (!PyArg_ParseTuple(args, "|O:set_completer", &function)) @@ -265,9 +247,7 @@ It should return the next possible completion starting with 'text'.\ /* Exported function to read the current line buffer */ static PyObject * -get_line_buffer(self, args) - PyObject *self; - PyObject *args; +get_line_buffer(PyObject *self, PyObject *args) { if (!PyArg_NoArgs(args)) return NULL; @@ -282,9 +262,7 @@ return the current contents of the line buffer.\ /* Exported function to insert text into the line buffer */ static PyObject * -insert_text(self, args) - PyObject *self; - PyObject *args; +insert_text(PyObject *self, PyObject *args) { char *s; if (!PyArg_ParseTuple(args, "s:insert_text", &s)) @@ -325,9 +303,7 @@ static struct PyMethodDef readline_methods[] = /* C function to call the Python completer. */ static char * -on_completion(text, state) - char *text; - int state; +on_completion(char *text, int state) { char *result = NULL; if (completer != NULL) { @@ -366,10 +342,7 @@ on_completion(text, state) * before calling the normal completer */ char ** -flex_complete(text, start, end) - char *text; - int start; - int end; +flex_complete(char *text, int start, int end) { Py_XDECREF(begidx); Py_XDECREF(endidx); @@ -413,8 +386,7 @@ static jmp_buf jbuf; /* ARGSUSED */ static RETSIGTYPE -onintr(sig) - int sig; +onintr(int sig) { longjmp(jbuf, 1); } @@ -423,8 +395,7 @@ onintr(sig) /* Wrapper around GNU readline that handles signals differently. */ static char * -call_readline(prompt) - char *prompt; +call_readline(char *prompt) { size_t n; char *p, *q; diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index cff72932a9d..492adf26593 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -42,8 +42,7 @@ static char decompressobj__doc__[] = ; static compobject * -newcompobject(type) - PyTypeObject *type; +newcompobject(PyTypeObject *type) { compobject *self; self = PyObject_New(compobject, type); @@ -62,9 +61,7 @@ static char compress__doc__[] = ; static PyObject * -PyZlib_compress(self, args) - PyObject *self; - PyObject *args; +PyZlib_compress(PyObject *self, PyObject *args) { PyObject *ReturnVal; Byte *input, *output; @@ -160,9 +157,7 @@ static char decompress__doc__[] = ; static PyObject * -PyZlib_decompress(self, args) - PyObject *self; - PyObject *args; +PyZlib_decompress(PyObject *self, PyObject *args) { PyObject *result_str; Byte *input; @@ -267,9 +262,7 @@ PyZlib_decompress(self, args) } static PyObject * -PyZlib_compressobj(selfptr, args) - PyObject *selfptr; - PyObject *args; +PyZlib_compressobj(PyObject *selfptr, PyObject *args) { compobject *self; int level=Z_DEFAULT_COMPRESSION, method=DEFLATED; @@ -316,9 +309,7 @@ PyZlib_compressobj(selfptr, args) } static PyObject * -PyZlib_decompressobj(selfptr, args) - PyObject *selfptr; - PyObject *args; +PyZlib_decompressobj(PyObject *selfptr, PyObject *args) { int wbits=DEF_WBITS, err; compobject *self; @@ -363,8 +354,7 @@ PyZlib_decompressobj(selfptr, args) } static void -Comp_dealloc(self) - compobject *self; +Comp_dealloc(compobject *self) { if (self->is_initialised) deflateEnd(&self->zst); @@ -373,8 +363,7 @@ Comp_dealloc(self) } static void -Decomp_dealloc(self) - compobject *self; +Decomp_dealloc(compobject *self) { inflateEnd(&self->zst); Py_XDECREF(self->unused_data); @@ -390,9 +379,7 @@ static char comp_compress__doc__[] = static PyObject * -PyZlib_objcompress(self, args) - compobject *self; - PyObject *args; +PyZlib_objcompress(compobject *self, PyObject *args) { int err = Z_OK, inplen; int length = DEFAULTALLOC; @@ -449,9 +436,7 @@ static char decomp_decompress__doc__[] = ; static PyObject * -PyZlib_objdecompress(self, args) - compobject *self; - PyObject *args; +PyZlib_objdecompress(compobject *self, PyObject *args) { int length, err, inplen; PyObject *RetVal; @@ -523,9 +508,7 @@ static char comp_flush__doc__[] = ; static PyObject * -PyZlib_flush(self, args) - compobject *self; - PyObject *args; +PyZlib_flush(compobject *self, PyObject *args) { int length=DEFAULTALLOC, err = Z_OK; PyObject *RetVal; @@ -622,9 +605,7 @@ static char decomp_flush__doc__[] = ; static PyObject * -PyZlib_unflush(self, args) - compobject *self; - PyObject *args; +PyZlib_unflush(compobject *self, PyObject *args) { int length=0, err; PyObject *RetVal; @@ -707,17 +688,13 @@ static PyMethodDef Decomp_methods[] = }; static PyObject * -Comp_getattr(self, name) - compobject *self; - char *name; +Comp_getattr(compobject *self, char *name) { return Py_FindMethod(comp_methods, (PyObject *)self, name); } static PyObject * -Decomp_getattr(self, name) - compobject *self; - char *name; +Decomp_getattr(compobject *self, char *name) { if (strcmp(name, "unused_data") == 0) { @@ -735,8 +712,7 @@ static char adler32__doc__[] = ; static PyObject * -PyZlib_adler32(self, args) - PyObject *self, *args; +PyZlib_adler32(PyObject *self, PyObject *args) { uLong adler32val=adler32(0L, Z_NULL, 0); Byte *buf; @@ -758,8 +734,7 @@ static char crc32__doc__[] = ; static PyObject * -PyZlib_crc32(self, args) - PyObject *self, *args; +PyZlib_crc32(PyObject *self, PyObject *args) { uLong crc32val=crc32(0L, Z_NULL, 0); Byte *buf; @@ -824,10 +799,7 @@ statichere PyTypeObject Decomptype = { /* Convenience routine to export an integer value. For simplicity, errors (which are unlikely anyway) are ignored. */ static void -insint(d, name, value) - PyObject *d; - char *name; - int value; +insint(PyObject *d, char *name, int value) { PyObject *v = PyInt_FromLong((long) value); if (v == NULL) {