ANSI-fication, not really tested, but should (hopefully) compile

This commit is contained in:
Peter Schneider-Kamp 2000-07-10 17:06:38 +00:00
parent 6a85027a97
commit cb27c35aa6
2 changed files with 34 additions and 116 deletions

View File

@ -54,17 +54,8 @@ staticforward PyTypeObject Bsddbtype;
static PyObject *BsddbError;
static PyObject *
newdbhashobject(file, flags, mode,
bsize, ffactor, nelem, cachesize, hash, lorder)
char *file;
int flags;
int mode;
int bsize;
int ffactor;
int nelem;
int cachesize;
int hash; /* XXX ignored */
int lorder;
newdbhashobject(char *file, int flags, int mode,
int bsize, int ffactor, int nelem, int cachesize, int hash, int lorder)
{
bsddbobject *dp;
HASHINFO info;
@ -108,17 +99,8 @@ newdbhashobject(file, flags, mode,
}
static PyObject *
newdbbtobject(file, flags, mode,
btflags, cachesize, maxkeypage, minkeypage, psize, lorder)
char *file;
int flags;
int mode;
int btflags;
int cachesize;
int maxkeypage;
int minkeypage;
int psize;
int lorder;
newdbbtobject(char *file, int flags, int mode,
int btflags, int cachesize, int maxkeypage, int minkeypage, int psize, int lorder)
{
bsddbobject *dp;
BTREEINFO info;
@ -164,18 +146,8 @@ newdbbtobject(file, flags, mode,
}
static PyObject *
newdbrnobject(file, flags, mode,
rnflags, cachesize, psize, lorder, reclen, bval, bfname)
char *file;
int flags;
int mode;
int rnflags;
int cachesize;
int psize;
int lorder;
size_t reclen;
u_char bval;
char *bfname;
newdbrnobject(char *file, int flags, int mode,
int rnflags, int cachesize, int psize, int lorder, size_t reclen, u_char bval, char *bfname)
{
bsddbobject *dp;
RECNOINFO info;
@ -220,8 +192,7 @@ newdbrnobject(file, flags, mode,
}
static void
bsddb_dealloc(dp)
bsddbobject *dp;
bsddb_dealloc(bsddbobject *dp)
{
#ifdef WITH_THREAD
if (dp->di_lock) {
@ -253,8 +224,7 @@ bsddb_dealloc(dp)
#endif
static int
bsddb_length(dp)
bsddbobject *dp;
bsddb_length(bsddbobject *dp)
{
if (dp->di_bsddb == NULL) {
PyErr_SetString(BsddbError, "BSDDB object has already been closed");
@ -282,9 +252,7 @@ bsddb_length(dp)
}
static PyObject *
bsddb_subscript(dp, key)
bsddbobject *dp;
PyObject *key;
bsddb_subscript(bsddbobject *dp, PyObject *key)
{
int status;
DBT krec, drec;
@ -321,9 +289,7 @@ bsddb_subscript(dp, key)
}
static int
bsddb_ass_sub(dp, key, value)
bsddbobject *dp;
PyObject *key, *value;
bsddb_ass_sub(bsddbobject *dp, PyObject *key, PyObject *value)
{
int status;
DBT krec, drec;
@ -387,9 +353,7 @@ static PyMappingMethods bsddb_as_mapping = {
};
static PyObject *
bsddb_close(dp, args)
bsddbobject *dp;
PyObject *args;
bsddb_close(bsddbobject *dp, PyObject *args)
{
if (!PyArg_NoArgs(args))
return NULL;
@ -410,9 +374,7 @@ bsddb_close(dp, args)
}
static PyObject *
bsddb_keys(dp, args)
bsddbobject *dp;
PyObject *args;
bsddb_keys(bsddbobject *dp, PyObject *args)
{
PyObject *list, *item;
DBT krec, drec;
@ -467,9 +429,7 @@ bsddb_keys(dp, args)
}
static PyObject *
bsddb_has_key(dp, args)
bsddbobject *dp;
PyObject *args;
bsddb_has_key(bsddbobject *dp, PyObject *args)
{
DBT krec, drec;
int status;
@ -494,9 +454,7 @@ bsddb_has_key(dp, args)
}
static PyObject *
bsddb_set_location(dp, key)
bsddbobject *dp;
PyObject *key;
bsddb_set_location(bsddbobject *dp, PyObject *key)
{
int status;
DBT krec, drec;
@ -532,10 +490,7 @@ bsddb_set_location(dp, key)
}
static PyObject *
bsddb_seq(dp, args, sequence_request)
bsddbobject *dp;
PyObject *args;
int sequence_request;
bsddb_seq(bsddbobject *dp, PyObject *args, int sequence_request)
{
int status;
DBT krec, drec;
@ -577,37 +532,27 @@ bsddb_seq(dp, args, sequence_request)
}
static PyObject *
bsddb_next(dp, key)
bsddbobject *dp;
PyObject *key;
bsddb_next(bsddbobject *dp, PyObject *key)
{
return bsddb_seq(dp, key, R_NEXT);
}
static PyObject *
bsddb_previous(dp, key)
bsddbobject *dp;
PyObject *key;
bsddb_previous(bsddbobject *dp, PyObject *key)
{
return bsddb_seq(dp, key, R_PREV);
}
static PyObject *
bsddb_first(dp, key)
bsddbobject *dp;
PyObject *key;
bsddb_first(bsddbobject *dp, PyObject *key)
{
return bsddb_seq(dp, key, R_FIRST);
}
static PyObject *
bsddb_last(dp, key)
bsddbobject *dp;
PyObject *key;
bsddb_last(bsddbobject *dp, PyObject *key)
{
return bsddb_seq(dp, key, R_LAST);
}
static PyObject *
bsddb_sync(dp, args)
bsddbobject *dp;
PyObject *args;
bsddb_sync(bsddbobject *dp, PyObject *args)
{
int status;
@ -637,9 +582,7 @@ static PyMethodDef bsddb_methods[] = {
};
static PyObject *
bsddb_getattr(dp, name)
PyObject *dp;
char *name;
bsddb_getattr(PyObject *dp, char *name)
{
return Py_FindMethod(bsddb_methods, dp, name);
}
@ -662,9 +605,7 @@ static PyTypeObject Bsddbtype = {
};
static PyObject *
bsdhashopen(self, args)
PyObject *self;
PyObject *args;
bsdhashopen(PyObject *self, PyObject *args)
{
char *file;
char *flag = NULL;
@ -715,9 +656,7 @@ bsdhashopen(self, args)
}
static PyObject *
bsdbtopen(self, args)
PyObject *self;
PyObject *args;
bsdbtopen(PyObject *self, PyObject *args)
{
char *file;
char *flag = NULL;
@ -769,9 +708,7 @@ bsdbtopen(self, args)
}
static PyObject *
bsdrnopen(self, args)
PyObject *self;
PyObject *args;
bsdrnopen(PyObject *self, PyObject *args)
{
char *file;
char *flag = NULL;

View File

@ -34,10 +34,7 @@ staticforward PyTypeObject Dbmtype;
static PyObject *DbmError;
static PyObject *
newdbmobject(file, flags, mode)
char *file;
int flags;
int mode;
newdbmobject(char *file, int flags, int mode)
{
dbmobject *dp;
@ -56,8 +53,7 @@ int mode;
/* Methods */
static void
dbm_dealloc(dp)
register dbmobject *dp;
dbm_dealloc(register dbmobject *dp)
{
if ( dp->di_dbm )
dbm_close(dp->di_dbm);
@ -65,8 +61,7 @@ dbm_dealloc(dp)
}
static int
dbm_length(dp)
dbmobject *dp;
dbm_length(dbmobject *dp)
{
if (dp->di_dbm == NULL) {
PyErr_SetString(DbmError, "DBM object has already been closed");
@ -86,9 +81,7 @@ dbm_length(dp)
}
static PyObject *
dbm_subscript(dp, key)
dbmobject *dp;
register PyObject *key;
dbm_subscript(dbmobject *dp, register PyObject *key)
{
datum drec, krec;
@ -111,9 +104,7 @@ register PyObject *key;
}
static int
dbm_ass_sub(dp, v, w)
dbmobject *dp;
PyObject *v, *w;
dbm_ass_sub(dbmobject *dp, PyObject *v, PyObject *w)
{
datum krec, drec;
@ -162,9 +153,7 @@ static PyMappingMethods dbm_as_mapping = {
};
static PyObject *
dbm__close(dp, args)
register dbmobject *dp;
PyObject *args;
dbm__close(register dbmobject *dp, PyObject *args)
{
if ( !PyArg_NoArgs(args) )
return NULL;
@ -176,9 +165,7 @@ PyObject *args;
}
static PyObject *
dbm_keys(dp, args)
register dbmobject *dp;
PyObject *args;
dbm_keys(register dbmobject *dp, PyObject *args)
{
register PyObject *v, *item;
datum key;
@ -208,9 +195,7 @@ PyObject *args;
}
static PyObject *
dbm_has_key(dp, args)
register dbmobject *dp;
PyObject *args;
dbm_has_key(register dbmobject *dp, PyObject *args)
{
datum key, val;
@ -229,9 +214,7 @@ static PyMethodDef dbm_methods[] = {
};
static PyObject *
dbm_getattr(dp, name)
dbmobject *dp;
char *name;
dbm_getattr(dbmobject *dp, char *name)
{
return Py_FindMethod(dbm_methods, (PyObject *)dp, name);
}
@ -256,9 +239,7 @@ static PyTypeObject Dbmtype = {
/* ----------------------------------------------------------------- */
static PyObject *
dbmopen(self, args)
PyObject *self;
PyObject *args;
dbmopen(PyObject *self, PyObject *args)
{
char *name;
char *flags = "r";