ANSI-fication
diff --git a/Modules/rotormodule.c b/Modules/rotormodule.c
index d63ad74..6960acf 100644
--- a/Modules/rotormodule.c
+++ b/Modules/rotormodule.c
@@ -87,8 +87,7 @@
/* This defines the necessary routines to manage rotor objects */
static void
-set_seed(r)
- Rotorobj *r;
+set_seed(Rotorobj *r)
{
r->seed[0] = r->key[0];
r->seed[1] = r->key[1];
@@ -98,8 +97,7 @@
/* Return the next random number in the range [0.0 .. 1.0) */
static double
-r_random(r)
- Rotorobj *r;
+r_random(Rotorobj *r)
{
int x, y, z;
double val, term;
@@ -134,17 +132,13 @@
}
static short
-r_rand(r, s)
- Rotorobj *r;
- short s;
+r_rand(Rotorobj *r, short s)
{
return (short)((short)(r_random(r) * (double)s) % s);
}
static void
-set_key(r, key)
- Rotorobj *r;
- char *key;
+set_key(Rotorobj *r, char *key)
{
unsigned long k1=995, k2=576, k3=767, k4=671, k5=463;
size_t i;
@@ -172,9 +166,7 @@
/* These define the interface to a rotor object */
static Rotorobj *
-rotorobj_new(num_rotors, key)
- int num_rotors;
- char *key;
+rotorobj_new(int num_rotors, char *key)
{
Rotorobj *xp;
@@ -251,9 +243,7 @@
/* Set ROTOR to the identity permutation */
static void
-RTR_make_id_rotor(r, rtr)
- Rotorobj *r;
- unsigned char *rtr;
+RTR_make_id_rotor(Rotorobj *r, unsigned char *rtr)
{
register int j;
register int size = r->size;
@@ -265,8 +255,7 @@
/* The current set of encryption rotors */
static void
-RTR_e_rotors(r)
- Rotorobj *r;
+RTR_e_rotors(Rotorobj *r)
{
int i;
for (i = 0; i < r->rotors; i++) {
@@ -276,8 +265,7 @@
/* The current set of decryption rotors */
static void
-RTR_d_rotors(r)
- Rotorobj *r;
+RTR_d_rotors(Rotorobj *r)
{
register int i, j;
for (i = 0; i < r->rotors; i++) {
@@ -289,8 +277,7 @@
/* The positions of the rotors at this time */
static void
-RTR_positions(r)
- Rotorobj *r;
+RTR_positions(Rotorobj *r)
{
int i;
for (i = 0; i < r->rotors; i++) {
@@ -300,8 +287,7 @@
/* The number of positions to advance the rotors at a time */
static void
-RTR_advances(r)
- Rotorobj *r;
+RTR_advances(Rotorobj *r)
{
int i;
for (i = 0; i < r->rotors; i++) {
@@ -313,10 +299,7 @@
* see Knuth for explanation of algorithm.
*/
static void
-RTR_permute_rotor(r, e, d)
- Rotorobj *r;
- unsigned char *e;
- unsigned char *d;
+RTR_permute_rotor(Rotorobj *r, unsigned char *e, unsigned char *d)
{
short i = r->size;
short q;
@@ -338,8 +321,7 @@
* Set the advancement, position, and permutation of the rotors
*/
static void
-RTR_init(r)
- Rotorobj *r;
+RTR_init(Rotorobj *r)
{
int i;
set_seed(r);
@@ -359,8 +341,7 @@
/* Change the RTR-positions vector, using the RTR-advances vector */
static void
-RTR_advance(r)
- Rotorobj *r;
+RTR_advance(Rotorobj *r)
{
register int i=0, temp=0;
if (r->size_mask) {
@@ -386,9 +367,7 @@
/* Encrypt the character P with the current rotor machine */
static unsigned char
-RTR_e_char(r, p)
- Rotorobj *r;
- unsigned char p;
+RTR_e_char(Rotorobj *r, unsigned char p)
{
register int i=0;
register unsigned char tp=p;
@@ -413,9 +392,7 @@
/* Decrypt the character C with the current rotor machine */
static unsigned char
-RTR_d_char(r, c)
- Rotorobj *r;
- unsigned char c;
+RTR_d_char(Rotorobj *r, unsigned char c)
{
register int i = r->rotors - 1;
register unsigned char tc = c;
@@ -440,11 +417,7 @@
/* Perform a rotor encryption of the region from BEG to END by KEY */
static void
-RTR_e_region(r, beg, len, doinit)
- Rotorobj *r;
- unsigned char *beg;
- int len;
- int doinit;
+RTR_e_region(Rotorobj *r, unsigned char *beg, int len, int doinit)
{
register int i;
if (doinit || r->isinited == FALSE)
@@ -456,11 +429,7 @@
/* Perform a rotor decryption of the region from BEG to END by KEY */
static void
-RTR_d_region(r, beg, len, doinit)
- Rotorobj *r;
- unsigned char *beg;
- int len;
- int doinit;
+RTR_d_region(Rotorobj *r, unsigned char *beg, int len, int doinit)
{
register int i;
if (doinit || r->isinited == FALSE)
@@ -474,8 +443,7 @@
/* Rotor methods */
static void
-rotor_dealloc(xp)
- Rotorobj *xp;
+rotor_dealloc(Rotorobj *xp)
{
if (xp->e_rotor)
PyMem_DEL(xp->e_rotor);
@@ -489,9 +457,7 @@
}
static PyObject *
-rotorobj_encrypt(self, args)
- Rotorobj *self;
- PyObject * args;
+rotorobj_encrypt(Rotorobj *self, PyObject *args)
{
char *string = NULL;
int len = 0;
@@ -513,9 +479,7 @@
}
static PyObject *
-rotorobj_encrypt_more(self, args)
- Rotorobj *self;
- PyObject * args;
+rotorobj_encrypt_more(Rotorobj *self, PyObject *args)
{
char *string = NULL;
int len = 0;
@@ -537,9 +501,7 @@
}
static PyObject *
-rotorobj_decrypt(self, args)
- Rotorobj *self;
- PyObject * args;
+rotorobj_decrypt(Rotorobj *self, PyObject *args)
{
char *string = NULL;
int len = 0;
@@ -561,9 +523,7 @@
}
static PyObject *
-rotorobj_decrypt_more(self, args)
- Rotorobj *self;
- PyObject * args;
+rotorobj_decrypt_more(Rotorobj *self, PyObject *args)
{
char *string = NULL;
int len = 0;
@@ -585,9 +545,7 @@
}
static PyObject *
-rotorobj_setkey(self, args)
- Rotorobj *self;
- PyObject * args;
+rotorobj_setkey(Rotorobj *self, PyObject *args)
{
char *key;
@@ -612,9 +570,7 @@
/* Return a rotor object's named attribute. */
static PyObject *
-rotorobj_getattr(s, name)
- Rotorobj *s;
- char *name;
+rotorobj_getattr(Rotorobj *s, char *name)
{
return Py_FindMethod(rotorobj_methods, (PyObject*)s, name);
}
@@ -638,9 +594,7 @@
static PyObject *
-rotor_rotor(self, args)
- PyObject * self;
- PyObject * args;
+rotor_rotor(PyObject *self, PyObject *args)
{
Rotorobj *r;
char *string;