Commit 4c3e7459 authored by Jim Fulton's avatar Jim Fulton

Rewrote a macro and it's calls to avoid confusing optimizing

compilers.
parent 57145891
......@@ -83,7 +83,7 @@
****************************************************************************/
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.12 2001/03/20 13:52:00 jim Exp $\n"
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.13 2001/03/21 14:16:58 jim Exp $\n"
/*
** _BTree_get
......@@ -96,7 +96,7 @@ _BTree_get(BTree *self, PyObject *keyarg, int has_key)
PyObject *r;
KEY_TYPE key;
COPY_KEY_FROM_ARG(key, keyarg, &copied);
COPY_KEY_FROM_ARG(key, keyarg, copied);
UNLESS (copied) return NULL;
PER_USE_OR_RETURN(self, NULL);
......@@ -409,7 +409,7 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
BTreeItem *d;
KEY_TYPE key;
COPY_KEY_FROM_ARG(key, keyarg, &copied);
COPY_KEY_FROM_ARG(key, keyarg, copied);
UNLESS (copied) return -1;
PER_USE_OR_RETURN(self, -1);
......@@ -754,7 +754,7 @@ _BTree_setstate(BTree *self, PyObject *state, int noval)
{
if (i)
{
COPY_KEY_FROM_ARG(d->key, PyTuple_GET_ITEM(items,l), &copied);
COPY_KEY_FROM_ARG(d->key, PyTuple_GET_ITEM(items,l), copied);
l++;
UNLESS (&copied) return -1;
INCREF_KEY(d->key);
......@@ -873,7 +873,7 @@ BTree_findRangeEnd(BTree *self, PyObject *keyarg, int low,
int min, max, i=0, cmp, copied=1;
KEY_TYPE key;
COPY_KEY_FROM_ARG(key, keyarg, &copied);
COPY_KEY_FROM_ARG(key, keyarg, copied);
UNLESS (copied) return -1;
/* We don't need to: PER_USE_OR_RETURN(self, -1);
......@@ -1124,7 +1124,7 @@ BTree_byValue(BTree *self, PyObject *args)
PER_USE_OR_RETURN(self, NULL);
UNLESS (PyArg_ParseTuple(args, "O", &omin)) return NULL;
COPY_VALUE_FROM_ARG(min, omin, &copied);
COPY_VALUE_FROM_ARG(min, omin, copied);
UNLESS(copied) return NULL;
UNLESS (r=PyList_New(0)) goto err;
......
......@@ -82,7 +82,7 @@
****************************************************************************/
#define BUCKETTEMPLATE_C "$Id: BucketTemplate.c,v 1.9 2001/03/20 13:52:00 jim Exp $\n"
#define BUCKETTEMPLATE_C "$Id: BucketTemplate.c,v 1.10 2001/03/21 14:16:58 jim Exp $\n"
/*
** _bucket_get
......@@ -102,7 +102,7 @@ _bucket_get(Bucket *self, PyObject *keyarg, int has_key)
PyObject *r;
KEY_TYPE key;
COPY_KEY_FROM_ARG(key, keyarg, &copied);
COPY_KEY_FROM_ARG(key, keyarg, copied);
UNLESS (copied) return NULL;
PER_USE_OR_RETURN(self, NULL);
......@@ -194,7 +194,7 @@ _bucket_set(Bucket *self, PyObject *keyarg, PyObject *v,
int min, max, i, l, cmp, copied=1;
KEY_TYPE key;
COPY_KEY_FROM_ARG(key, keyarg, &copied);
COPY_KEY_FROM_ARG(key, keyarg, copied);
UNLESS(copied) return -1;
PER_USE_OR_RETURN(self, -1);
......@@ -210,7 +210,7 @@ _bucket_set(Bucket *self, PyObject *keyarg, PyObject *v,
{
VALUE_TYPE value;
COPY_VALUE_FROM_ARG(value, v, &copied);
COPY_VALUE_FROM_ARG(value, v, copied);
UNLESS(copied) return -1;
#ifdef VALUE_SAME
......@@ -295,7 +295,7 @@ _bucket_set(Bucket *self, PyObject *keyarg, PyObject *v,
UNLESS (noval)
{
COPY_VALUE_FROM_ARG(self->values[i], v, &copied);
COPY_VALUE_FROM_ARG(self->values[i], v, copied);
UNLESS(copied) return -1;
INCREF_VALUE(self->values[i]);
}
......@@ -487,7 +487,7 @@ Bucket_findRangeEnd(Bucket *self, PyObject *keyarg, int low, int *offset)
Bucket *release = NULL;
KEY_TYPE key;
COPY_KEY_FROM_ARG(key, keyarg, &copied);
COPY_KEY_FROM_ARG(key, keyarg, copied);
UNLESS (copied) return -1;
PER_USE_OR_RETURN(self, -1);
......@@ -768,7 +768,7 @@ bucket_byValue(Bucket *self, PyObject *args)
PER_USE_OR_RETURN(self, NULL);
UNLESS (PyArg_ParseTuple(args, "O", &omin)) return NULL;
COPY_VALUE_FROM_ARG(min, omin, &copied);
COPY_VALUE_FROM_ARG(min, omin, copied);
UNLESS(copied) return NULL;
for (i=0, l=0; i < self->len; i++)
......@@ -994,9 +994,9 @@ _bucket_setstate(Bucket *self, PyObject *args)
v=PyTuple_GET_ITEM(items, l);
l++;
COPY_KEY_FROM_ARG(self->keys[i], k, &copied);
COPY_KEY_FROM_ARG(self->keys[i], k, copied);
UNLESS (copied) return -1;
COPY_VALUE_FROM_ARG(self->values[i], v, &copied);
COPY_VALUE_FROM_ARG(self->values[i], v, copied);
UNLESS (copied) return -1;
INCREF_KEY(self->keys[i]);
INCREF_VALUE(self->values[i]);
......
......@@ -87,7 +87,7 @@
Set operations
****************************************************************************/
#define SETOPTEMPLATE_C "$Id: SetOpTemplate.c,v 1.5 2001/03/20 13:52:00 jim Exp $\n"
#define SETOPTEMPLATE_C "$Id: SetOpTemplate.c,v 1.6 2001/03/21 14:16:58 jim Exp $\n"
#ifdef INTSET_H
static int
......@@ -202,7 +202,7 @@ initSetIteration(SetIteration *i, PyObject *s, int w, int *merge)
Py_INCREF(s);
i->next=nextKeyAsSet;
i->hasValue=0;
COPY_KEY_FROM_ARG(i->key, s, &copied);
COPY_KEY_FROM_ARG(i->key, s, copied);
UNLESS (copied) return -1;
}
#endif
......
......@@ -83,7 +83,7 @@
****************************************************************************/
#define SETTEMPLATE_C "$Id: SetTemplate.c,v 1.9 2001/03/20 13:52:00 jim Exp $\n"
#define SETTEMPLATE_C "$Id: SetTemplate.c,v 1.10 2001/03/21 14:16:58 jim Exp $\n"
static PyObject *
Set_insert(Bucket *self, PyObject *args)
......@@ -179,7 +179,7 @@ _set_setstate(Bucket *self, PyObject *args)
for (i=0; i<l; i++)
{
k=PyTuple_GET_ITEM(items, i);
COPY_KEY_FROM_ARG(self->keys[i], k, &copied);
COPY_KEY_FROM_ARG(self->keys[i], k, copied);
UNLESS (copied) return -1;
INCREF_KEY(self->keys[i]);
}
......
#define KEYMACROS_H "$Id: intkeymacros.h,v 1.4 2001/03/20 13:52:00 jim Exp $\n"
#define KEYMACROS_H "$Id: intkeymacros.h,v 1.5 2001/03/21 14:16:58 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; }
#define VALUEMACROS_H "$Id: intvaluemacros.h,v 1.5 2001/03/20 13:52:00 jim Exp $\n"
#define VALUEMACROS_H "$Id: intvaluemacros.h,v 1.6 2001/03/21 14:16:58 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; }
#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