Commit 0181d9a0 authored by Jim Fulton's avatar Jim Fulton

numerous changes to prevent gcc warnings

parent c1cbc703
......@@ -340,7 +340,7 @@ static char BTree_module_documentation[] =
"\n"
MASTER_ID
BTREEITEMSTEMPLATE_C
"$Id: BTreeModuleTemplate.c,v 1.10 2001/04/02 16:56:09 jeremy Exp $\n"
"$Id: BTreeModuleTemplate.c,v 1.11 2001/04/03 15:02:17 jim Exp $\n"
BTREETEMPLATE_C
BUCKETTEMPLATE_C
KEYMACROS_H
......@@ -366,7 +366,7 @@ INITMODULE (void)
return;
#ifdef PERSISTENT
if (cPersistenceCAPI=PyCObject_Import("cPersistence","CAPI"))
if ((cPersistenceCAPI=PyCObject_Import("cPersistence","CAPI")))
{
BucketType.methods.link=cPersistenceCAPI->methods;
BucketType.tp_getattro=cPersistenceCAPI->getattro;
......@@ -409,7 +409,7 @@ INITMODULE (void)
d = PyModule_GetDict(m);
PyDict_SetItemString(d, "__version__",
PyString_FromString("$Revision: 1.10 $"));
PyString_FromString("$Revision: 1.11 $"));
PyExtensionClass_Export(d,MOD_NAME_PREFIX "Bucket", BucketType);
PyExtensionClass_Export(d,MOD_NAME_PREFIX "BTree", BTreeType);
......
......@@ -83,7 +83,7 @@
****************************************************************************/
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.15 2001/04/02 16:57:40 jeremy Exp $\n"
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.16 2001/04/03 15:02:17 jim Exp $\n"
/*
** _BTree_get
......@@ -505,36 +505,43 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
}
self->len--;
Py_DECREF(d->value);
if (min) DECREF_KEY(d->key);
if (min)
{
DECREF_KEY(d->key);
}
if (min < self->len)
memmove(d, d+1, (self->len-min)*sizeof(BTreeItem));
if (! min)
if (self->len)
{ /* We just deleted our first child, so we need to
adjust our first bucket. */
if (SameType_Check(self, self->data->value))
{
UNLESS (PER_USE(BTREE(self->data->value))) goto err;
ASSIGNB(self->firstbucket,
BTREE(self->data->value)->firstbucket);
Py_XINCREF(self->firstbucket);
PER_ALLOW_DEACTIVATION(BTREE(self->data->value));
PER_ACCESSED(BTREE(self->data->value));
}
else
{
ASSIGNB(self->firstbucket, BUCKET(self->data->value));
Py_INCREF(self->firstbucket);
}
/* We can toss our first key now */
DECREF_KEY(self->data->key);
}
else
{
Py_XDECREF(self->firstbucket);
self->firstbucket = 0;
}
{
if (self->len)
{ /* We just deleted our first child, so we need to
adjust our first bucket. */
if (SameType_Check(self, self->data->value))
{
UNLESS (PER_USE(BTREE(self->data->value))) goto err;
ASSIGNB(self->firstbucket,
BTREE(self->data->value)->firstbucket);
Py_XINCREF(self->firstbucket);
PER_ALLOW_DEACTIVATION(BTREE(self->data->value));
PER_ACCESSED(BTREE(self->data->value));
}
else
{
ASSIGNB(self->firstbucket,
BUCKET(self->data->value));
Py_INCREF(self->firstbucket);
}
/* We can toss our first key now */
DECREF_KEY(self->data->key);
}
else
{
Py_XDECREF(self->firstbucket);
self->firstbucket = 0;
}
}
changed=1;
}
}
......@@ -612,7 +619,10 @@ _BTree_clear(BTree *self)
for (l=self->len, i=0; i < l; i++)
{
if (i) DECREF_KEY(self->data[i].key);
if (i)
{
DECREF_KEY(self->data[i].key);
}
Py_DECREF(self->data[i].value);
}
self->len=0;
......
......@@ -82,7 +82,7 @@
****************************************************************************/
#define BUCKETTEMPLATE_C "$Id: BucketTemplate.c,v 1.13 2001/04/02 16:57:40 jeremy Exp $\n"
#define BUCKETTEMPLATE_C "$Id: BucketTemplate.c,v 1.14 2001/04/03 15:02:17 jim Exp $\n"
/*
** _bucket_get
......@@ -566,8 +566,6 @@ Bucket_maxminKey(Bucket *self, PyObject *args, int min)
empty:
PyErr_SetString(PyExc_ValueError, "empty bucket");
err:
PER_ALLOW_DEACTIVATION(self);
PER_ACCESSED(self);
return NULL;
......@@ -834,7 +832,10 @@ _bucket_clear(Bucket *self)
for (i=self->len; --i >= 0; )
{
DECREF_KEY(self->keys[i]);
if (self->values) DECREF_VALUE(self->values[i]);
if (self->values)
{
DECREF_VALUE(self->values[i]);
}
}
self->len=0;
if (self->values)
......@@ -1072,12 +1073,12 @@ _bucket__p_resolveConflict(PyObject *ob_type, PyObject *s[3])
for (i=0; i < 3; i++)
{
if (b[i]=(Bucket*)PyObject_CallObject(OBJECT(ob_type), NULL))
if ((b[i]=(Bucket*)PyObject_CallObject(OBJECT(ob_type), NULL)))
{
if (s[i] == Py_None) /* None is equivalent to empty, for BTrees */
if ((s[i] == Py_None)) /* None is equivalent to empty, for BTrees */
continue;
ASSIGN(r, PyObject_GetAttr(OBJECT(b[i]), __setstate___str));
if (a=PyTuple_New(1))
if ((a=PyTuple_New(1)))
{
if (r)
{
......
......@@ -83,7 +83,7 @@
****************************************************************************/
#define MERGETEMPLATE_C "$Id: MergeTemplate.c,v 1.4 2001/04/02 16:57:40 jeremy Exp $\n"
#define MERGETEMPLATE_C "$Id: MergeTemplate.c,v 1.5 2001/04/03 15:02:17 jim Exp $\n"
/****************************************************************************
Set operations
......@@ -111,7 +111,10 @@ merge_error(int p1, int p2, int p3, int reason)
UNLESS (r=Py_BuildValue("iiii", p1, p2, p3, reason)) r=Py_None;
PyErr_SetObject(PyExc_ValueError, r);
if (r != Py_None) Py_DECREF(r);
if (r != Py_None)
{
Py_DECREF(r);
}
return NULL;
}
......@@ -330,9 +333,7 @@ bucket_merge(Bucket *s1, Bucket *s2, Bucket *s3)
return s;
invalid_set_operation:
PyErr_SetString(PyExc_TypeError, "invalid set operation");
err:
err:
Py_XDECREF(i1.set);
Py_XDECREF(i2.set);
Py_XDECREF(i3.set);
......
......@@ -87,7 +87,7 @@
Set operations
****************************************************************************/
#define SETOPTEMPLATE_C "$Id: SetOpTemplate.c,v 1.6 2001/03/21 14:16:58 jim Exp $\n"
#define SETOPTEMPLATE_C "$Id: SetOpTemplate.c,v 1.7 2001/04/03 15:02:17 jim Exp $\n"
#ifdef INTSET_H
static int
......@@ -357,8 +357,11 @@ set_operation(PyObject *s1, PyObject *s2,
return OBJECT(r);
#ifndef MERGE_DEFAULT
invalid_set_operation:
PyErr_SetString(PyExc_TypeError, "invalid set operation");
#endif
err:
Py_XDECREF(i1.set);
Py_XDECREF(i2.set);
......
#define KEYMACROS_H "$Id: intkeymacros.h,v 1.5 2001/03/21 14:16:58 jim Exp $\n"
#define KEYMACROS_H "$Id: intkeymacros.h,v 1.6 2001/04/03 15:02:17 jim Exp $\n"
#define KEY_TYPE int
#define KEY_CHECK PyInt_Check
......@@ -11,4 +11,4 @@
#define COPY_KEY_FROM_ARG(TARGET, ARG, STATUS) \
if (PyInt_Check(ARG)) TARGET=PyInt_AsLong(ARG); else { \
PyErr_SetString(PyExc_TypeError, "expected integer key"); \
(STATUS)=0; }
(STATUS)=0; (TARGET)=0; }
#define VALUEMACROS_H "$Id: intvaluemacros.h,v 1.6 2001/03/21 14:16:58 jim Exp $\n"
#define VALUEMACROS_H "$Id: intvaluemacros.h,v 1.7 2001/04/03 15:02:17 jim Exp $\n"
#define VALUE_TYPE int
#define TEST_VALUE(K, T) (((K) < (T)) ? -1 : (((K) > (T)) ? 1: 0))
......@@ -13,7 +13,7 @@
#define COPY_VALUE_FROM_ARG(TARGET, ARG, STATUS) \
if (PyInt_Check(ARG)) TARGET=PyInt_AsLong(ARG); else { \
PyErr_SetString(PyExc_TypeError, "expected integer value"); \
(STATUS)=0; }
(STATUS)=0; (TARGET)=0; }
#define NORMALIZE_VALUE(V, MIN) ((MIN) > 0) ? ((V)/=(MIN)) : 0
......
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