Commit 47fc3143 authored by Jim Fulton's avatar Jim Fulton

numerous changes to prevent gcc warnings

parent 3cad3d48
...@@ -340,7 +340,7 @@ static char BTree_module_documentation[] = ...@@ -340,7 +340,7 @@ static char BTree_module_documentation[] =
"\n" "\n"
MASTER_ID MASTER_ID
BTREEITEMSTEMPLATE_C 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 BTREETEMPLATE_C
BUCKETTEMPLATE_C BUCKETTEMPLATE_C
KEYMACROS_H KEYMACROS_H
...@@ -366,7 +366,7 @@ INITMODULE (void) ...@@ -366,7 +366,7 @@ INITMODULE (void)
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;
...@@ -409,7 +409,7 @@ INITMODULE (void) ...@@ -409,7 +409,7 @@ INITMODULE (void)
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
PyDict_SetItemString(d, "__version__", 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 "Bucket", BucketType);
PyExtensionClass_Export(d,MOD_NAME_PREFIX "BTree", BTreeType); PyExtensionClass_Export(d,MOD_NAME_PREFIX "BTree", BTreeType);
......
...@@ -83,7 +83,7 @@ ...@@ -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 ** _BTree_get
...@@ -505,36 +505,43 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value, ...@@ -505,36 +505,43 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
} }
self->len--; self->len--;
Py_DECREF(d->value); Py_DECREF(d->value);
if (min) DECREF_KEY(d->key); if (min)
{
DECREF_KEY(d->key);
}
if (min < self->len) if (min < self->len)
memmove(d, d+1, (self->len-min)*sizeof(BTreeItem)); memmove(d, d+1, (self->len-min)*sizeof(BTreeItem));
if (! min) if (! min)
if (self->len) {
{ /* We just deleted our first child, so we need to if (self->len)
adjust our first bucket. */ { /* We just deleted our first child, so we need to
if (SameType_Check(self, self->data->value)) adjust our first bucket. */
{ if (SameType_Check(self, self->data->value))
UNLESS (PER_USE(BTREE(self->data->value))) goto err; {
ASSIGNB(self->firstbucket, UNLESS (PER_USE(BTREE(self->data->value))) goto err;
BTREE(self->data->value)->firstbucket); ASSIGNB(self->firstbucket,
Py_XINCREF(self->firstbucket); BTREE(self->data->value)->firstbucket);
PER_ALLOW_DEACTIVATION(BTREE(self->data->value)); Py_XINCREF(self->firstbucket);
PER_ACCESSED(BTREE(self->data->value)); PER_ALLOW_DEACTIVATION(BTREE(self->data->value));
} PER_ACCESSED(BTREE(self->data->value));
else }
{ else
ASSIGNB(self->firstbucket, BUCKET(self->data->value)); {
Py_INCREF(self->firstbucket); ASSIGNB(self->firstbucket,
} BUCKET(self->data->value));
/* We can toss our first key now */ Py_INCREF(self->firstbucket);
DECREF_KEY(self->data->key); }
} /* We can toss our first key now */
else DECREF_KEY(self->data->key);
{ }
Py_XDECREF(self->firstbucket); else
self->firstbucket = 0; {
} Py_XDECREF(self->firstbucket);
self->firstbucket = 0;
}
}
changed=1; changed=1;
} }
} }
...@@ -612,7 +619,10 @@ _BTree_clear(BTree *self) ...@@ -612,7 +619,10 @@ _BTree_clear(BTree *self)
for (l=self->len, i=0; i < l; i++) 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); Py_DECREF(self->data[i].value);
} }
self->len=0; self->len=0;
......
...@@ -82,7 +82,7 @@ ...@@ -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 ** _bucket_get
...@@ -566,8 +566,6 @@ Bucket_maxminKey(Bucket *self, PyObject *args, int min) ...@@ -566,8 +566,6 @@ Bucket_maxminKey(Bucket *self, PyObject *args, int min)
empty: empty:
PyErr_SetString(PyExc_ValueError, "empty bucket"); PyErr_SetString(PyExc_ValueError, "empty bucket");
err:
PER_ALLOW_DEACTIVATION(self); PER_ALLOW_DEACTIVATION(self);
PER_ACCESSED(self); PER_ACCESSED(self);
return NULL; return NULL;
...@@ -834,7 +832,10 @@ _bucket_clear(Bucket *self) ...@@ -834,7 +832,10 @@ _bucket_clear(Bucket *self)
for (i=self->len; --i >= 0; ) for (i=self->len; --i >= 0; )
{ {
DECREF_KEY(self->keys[i]); DECREF_KEY(self->keys[i]);
if (self->values) DECREF_VALUE(self->values[i]); if (self->values)
{
DECREF_VALUE(self->values[i]);
}
} }
self->len=0; self->len=0;
if (self->values) if (self->values)
...@@ -1072,12 +1073,12 @@ _bucket__p_resolveConflict(PyObject *ob_type, PyObject *s[3]) ...@@ -1072,12 +1073,12 @@ _bucket__p_resolveConflict(PyObject *ob_type, PyObject *s[3])
for (i=0; i < 3; i++) 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; continue;
ASSIGN(r, PyObject_GetAttr(OBJECT(b[i]), __setstate___str)); ASSIGN(r, PyObject_GetAttr(OBJECT(b[i]), __setstate___str));
if (a=PyTuple_New(1)) if ((a=PyTuple_New(1)))
{ {
if (r) if (r)
{ {
......
...@@ -83,7 +83,7 @@ ...@@ -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 Set operations
...@@ -111,7 +111,10 @@ merge_error(int p1, int p2, int p3, int reason) ...@@ -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; UNLESS (r=Py_BuildValue("iiii", p1, p2, p3, reason)) r=Py_None;
PyErr_SetObject(PyExc_ValueError, r); PyErr_SetObject(PyExc_ValueError, r);
if (r != Py_None) Py_DECREF(r); if (r != Py_None)
{
Py_DECREF(r);
}
return NULL; return NULL;
} }
...@@ -330,9 +333,7 @@ bucket_merge(Bucket *s1, Bucket *s2, Bucket *s3) ...@@ -330,9 +333,7 @@ bucket_merge(Bucket *s1, Bucket *s2, Bucket *s3)
return s; return s;
invalid_set_operation: err:
PyErr_SetString(PyExc_TypeError, "invalid set operation");
err:
Py_XDECREF(i1.set); Py_XDECREF(i1.set);
Py_XDECREF(i2.set); Py_XDECREF(i2.set);
Py_XDECREF(i3.set); Py_XDECREF(i3.set);
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
Set operations 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 #ifdef INTSET_H
static int static int
...@@ -357,8 +357,11 @@ set_operation(PyObject *s1, PyObject *s2, ...@@ -357,8 +357,11 @@ set_operation(PyObject *s1, PyObject *s2,
return OBJECT(r); return OBJECT(r);
#ifndef MERGE_DEFAULT
invalid_set_operation: invalid_set_operation:
PyErr_SetString(PyExc_TypeError, "invalid set operation"); PyErr_SetString(PyExc_TypeError, "invalid set operation");
#endif
err: err:
Py_XDECREF(i1.set); Py_XDECREF(i1.set);
Py_XDECREF(i2.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_TYPE int
#define KEY_CHECK PyInt_Check #define KEY_CHECK PyInt_Check
...@@ -11,4 +11,4 @@ ...@@ -11,4 +11,4 @@
#define COPY_KEY_FROM_ARG(TARGET, ARG, STATUS) \ #define COPY_KEY_FROM_ARG(TARGET, ARG, STATUS) \
if (PyInt_Check(ARG)) TARGET=PyInt_AsLong(ARG); else { \ if (PyInt_Check(ARG)) TARGET=PyInt_AsLong(ARG); else { \
PyErr_SetString(PyExc_TypeError, "expected integer key"); \ 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 VALUE_TYPE int
#define TEST_VALUE(K, T) (((K) < (T)) ? -1 : (((K) > (T)) ? 1: 0)) #define TEST_VALUE(K, T) (((K) < (T)) ? -1 : (((K) > (T)) ? 1: 0))
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#define COPY_VALUE_FROM_ARG(TARGET, ARG, STATUS) \ #define COPY_VALUE_FROM_ARG(TARGET, ARG, STATUS) \
if (PyInt_Check(ARG)) TARGET=PyInt_AsLong(ARG); else { \ if (PyInt_Check(ARG)) TARGET=PyInt_AsLong(ARG); else { \
PyErr_SetString(PyExc_TypeError, "expected integer value"); \ PyErr_SetString(PyExc_TypeError, "expected integer value"); \
(STATUS)=0; } (STATUS)=0; (TARGET)=0; }
#define NORMALIZE_VALUE(V, MIN) ((MIN) > 0) ? ((V)/=(MIN)) : 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