Commit d6c03424 authored by Shane Hathaway's avatar Shane Hathaway

Silenced gcc warnings.

- Added parentheses to inline assignments.

- Removed the unused function "Twople".

- Unnecessarily initialized "iv" of BTree_ini().  (Compiler isn't smart
  enough to see that "iv" is never used uninitialized.)

- Added curly braces.

- Removed unused var "v" from BTree_setstate.

- Used "void" in place of empty parameter lists.
parent b42ea9da
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
static char BTree_module_documentation[] = static char BTree_module_documentation[] =
"" ""
"\n$Id: BTree.c,v 1.28 2000/05/16 17:36:00 jim Exp $" "\n$Id: BTree.c,v 1.29 2001/05/23 18:24:49 shane Exp $"
; ;
#define PERSISTENT #define PERSISTENT
...@@ -389,7 +389,7 @@ PyMalloc(size_t sz) ...@@ -389,7 +389,7 @@ PyMalloc(size_t sz)
{ {
void *r; void *r;
if(r=malloc(sz)) return r; if((r=malloc(sz))) return r;
PyErr_NoMemory(); PyErr_NoMemory();
return NULL; return NULL;
...@@ -400,28 +400,12 @@ PyRealloc(void *p, size_t sz) ...@@ -400,28 +400,12 @@ PyRealloc(void *p, size_t sz)
{ {
void *r; void *r;
if(r=realloc(p,sz)) return r; if((r=realloc(p,sz))) return r;
PyErr_NoMemory(); PyErr_NoMemory();
return NULL; return NULL;
} }
static PyObject *
Twople(PyObject *i1, PyObject *i2)
{
PyObject *t;
if(t=PyTuple_New(2))
{
Py_INCREF(i1);
PyTuple_SET_ITEM(t,0,i1);
Py_INCREF(i2);
PyTuple_SET_ITEM(t,1,i2);
}
return t;
}
static int static int
BTree_ini(BTree *self) BTree_ini(BTree *self)
{ {
...@@ -720,7 +704,7 @@ _bucket_set(Bucket *self, PyObject *key, PyObject *v) ...@@ -720,7 +704,7 @@ _bucket_set(Bucket *self, PyObject *key, PyObject *v)
int ikey; int ikey;
#endif #endif
#ifdef INTVAL #ifdef INTVAL
int iv; int iv = 0;
#endif #endif
#ifdef INTKEY #ifdef INTKEY
...@@ -1417,7 +1401,9 @@ bucket_setstate(Bucket *self, PyObject *args) ...@@ -1417,7 +1401,9 @@ bucket_setstate(Bucket *self, PyObject *args)
for(i=0; i<l; i++, d++) for(i=0; i<l; i++, d++)
{ {
UNLESS(r=PySequence_GetItem(keys,i)) goto err; UNLESS(r=PySequence_GetItem(keys,i)) goto err;
if(i < self->len) Py_DECREF(d->key); if(i < self->len) {
Py_DECREF(d->key);
}
d->key=r; d->key=r;
} }
#endif #endif
...@@ -1438,7 +1424,9 @@ bucket_setstate(Bucket *self, PyObject *args) ...@@ -1438,7 +1424,9 @@ bucket_setstate(Bucket *self, PyObject *args)
for(i=0; i<l; i++, d++) for(i=0; i<l; i++, d++)
{ {
UNLESS(r=PySequence_GetItem(values,i)) goto err; UNLESS(r=PySequence_GetItem(values,i)) goto err;
if(i < self->len) Py_DECREF(d->value); if(i < self->len) {
Py_DECREF(d->value);
}
d->value=r; d->value=r;
} }
#endif #endif
...@@ -1780,7 +1768,7 @@ err: ...@@ -1780,7 +1768,7 @@ err:
static PyObject * static PyObject *
BTree_setstate(BTree *self, PyObject *args) BTree_setstate(BTree *self, PyObject *args)
{ {
PyObject *state, *v=0; PyObject *state;
BTreeItem *d; BTreeItem *d;
int l, i; int l, i;
...@@ -2094,24 +2082,24 @@ static struct PyMethodDef module_methods[] = { ...@@ -2094,24 +2082,24 @@ static struct PyMethodDef module_methods[] = {
void void
#ifdef INTKEY #ifdef INTKEY
#ifdef INTVAL #ifdef INTVAL
initIIBTree() initIIBTree(void)
#define MODNAME "IIBTree" #define MODNAME "IIBTree"
#else #else
initIOBTree() initIOBTree(void)
#define MODNAME "IOBTree" #define MODNAME "IOBTree"
#endif #endif
#else #else
#ifdef INTVAL #ifdef INTVAL
initOIBTree() initOIBTree(void)
#define MODNAME "OIBTree" #define MODNAME "OIBTree"
#else #else
initBTree() initBTree(void)
#define MODNAME "BTree" #define MODNAME "BTree"
#endif #endif
#endif #endif
{ {
PyObject *m, *d; PyObject *m, *d;
char *rev="$Revision: 1.28 $"; char *rev="$Revision: 1.29 $";
...@@ -2119,7 +2107,7 @@ initBTree() ...@@ -2119,7 +2107,7 @@ initBTree()
return; return;
#ifdef PERSISTENT #ifdef PERSISTENT
if(cPersistenceCAPI=PyCObject_Import("cPersistence","CAPI")) if((cPersistenceCAPI=PyCObject_Import("cPersistence","CAPI")))
{ {
BucketType.methods.link=cPersistenceCAPI->methods; BucketType.methods.link=cPersistenceCAPI->methods;
BucketType.tp_getattro=cPersistenceCAPI->getattro; BucketType.tp_getattro=cPersistenceCAPI->getattro;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment