[Zodb-checkins] CVS: Zope3/lib/python/Persistence/BTrees - BTreeModuleTemplate.c:1.1.2.12
Tim Peters
tim.one@comcast.net
Tue, 4 Jun 2002 16:23:47 -0400
Update of /cvs-repository/Zope3/lib/python/Persistence/BTrees
In directory cvs.zope.org:/tmp/cvs-serv4336
Modified Files:
Tag: Zope-3x-branch
BTreeModuleTemplate.c
Log Message:
Trimmed trailing whitespace.
=== Zope3/lib/python/Persistence/BTrees/BTreeModuleTemplate.c 1.1.2.11 => 1.1.2.12 ===
Copyright (c) 2001, 2002 Zope Corporation and Contributors.
All Rights Reserved.
-
+
This software is subject to the provisions of the Zope Public License,
Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
FOR A PARTICULAR PURPOSE
-
+
****************************************************************************/
#include "Python.h"
@@ -34,7 +34,7 @@
qualified names of the types, e.g. Persistence.BTrees.OOBTree.OOBTree.
The full name is usd to support pickling and because it is not
possible to modify the __module__ slot of a type dynamically. (This
- may be a bug in Python 2.2).
+ may be a bug in Python 2.2).
*/
#define MODULE_NAME "Persistence.BTrees." MOD_NAME_PREFIX "BTree."
@@ -103,7 +103,7 @@
#define BTREE(O) ((BTree*)(O))
-typedef struct SetIteration_s
+typedef struct SetIteration_s
{
PyObject *set;
int position;
@@ -115,7 +115,7 @@
static PyObject *
IndexError(int i)
-{
+{
PyObject *v;
v = PyInt_FromLong(i);
@@ -128,14 +128,14 @@
return NULL;
}
-/* Returns a new reference to the bucket before current.
+/* Returns a new reference to the bucket before current.
Returns NULL and sets IndexError, i on error.
*/
static Bucket *
PreviousBucket(Bucket *current, Bucket *first, int i)
{
- if (!first)
+ if (!first)
return NULL;
if (first == current) {
IndexError(i);
@@ -169,7 +169,7 @@
}
}
-static int
+static int
firstBucketOffset(Bucket **bucket, int *offset)
{
Bucket *b;
@@ -177,7 +177,7 @@
*offset = (*bucket)->len - 1;
while ((*bucket)->len < 1) {
b = (*bucket)->next;
- if (b == NULL)
+ if (b == NULL)
return 0;
Py_INCREF(b);
PER_ALLOW_DEACTIVATION((*bucket));
@@ -193,7 +193,7 @@
return 1;
}
-static int
+static int
lastBucketOffset(Bucket **bucket, int *offset, Bucket *firstbucket, int i)
{
Bucket *b;
@@ -201,7 +201,7 @@
*offset = (*bucket)->len - 1;
while ((*bucket)->len < 1) {
b = PreviousBucket((*bucket), firstbucket, i);
- if (b == NULL)
+ if (b == NULL)
return 0;
PER_ALLOW_DEACTIVATION((*bucket));
Py_DECREF(*bucket);
@@ -238,14 +238,14 @@
ASSERT(sz > 0, "non-positive size realloc", NULL);
- if (p)
+ if (p)
r = realloc(p, sz);
- else
+ else
r = malloc(sz);
-
- UNLESS (r)
+
+ UNLESS (r)
PyErr_NoMemory();
-
+
return r;
}
@@ -283,7 +283,7 @@
{NULL, NULL} /* sentinel */
};
-static char BTree_module_documentation[] =
+static char BTree_module_documentation[] =
"\n"
MASTER_ID
BTREEITEMSTEMPLATE_C
@@ -304,7 +304,7 @@
{
type->ob_type = &PyType_Type;
type->tp_base = PyPersist_BASE_TYPE;
-
+
/* XXX for now */
type->tp_traverse = PyPersist_BASE_TYPE->tp_traverse;
type->tp_clear = PyPersist_BASE_TYPE->tp_clear;
@@ -327,7 +327,7 @@
return 0;
}
-void
+void
INITMODULE (void)
{
PyObject *m, *d, *c;
@@ -346,10 +346,10 @@
m = PyImport_ImportModule("Persistence.BTrees.Exception");
if (m != NULL) {
c = PyObject_GetAttrString(m, "BTreesConflictError");
- if (c != NULL)
+ if (c != NULL)
ConflictError = c;
- Py_DECREF(m);
- }
+ Py_DECREF(m);
+ }
if (ConflictError == NULL) {
Py_INCREF(PyExc_ValueError);
@@ -359,7 +359,7 @@
#ifdef INTSET_H
UNLESS(d = PyImport_ImportModule("intSet")) return;
UNLESS(intSetType = PyObject_GetAttrString (d, "intSet")) return;
- Py_DECREF (d);
+ Py_DECREF (d);
#endif
/* Initialize the PyPersist_C_API and the type objects. */
@@ -374,22 +374,22 @@
init_persist_type(&TreeSetType);
/* Create the module and add the functions */
- m = Py_InitModule4("_" MOD_NAME_PREFIX "BTree",
+ m = Py_InitModule4("_" MOD_NAME_PREFIX "BTree",
module_methods, BTree_module_documentation,
(PyObject *)NULL, PYTHON_API_VERSION);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
- if (PyDict_SetItemString(d, MOD_NAME_PREFIX "Bucket",
+ if (PyDict_SetItemString(d, MOD_NAME_PREFIX "Bucket",
(PyObject *)&BucketType) < 0)
return;
- if (PyDict_SetItemString(d, MOD_NAME_PREFIX "BTree",
+ if (PyDict_SetItemString(d, MOD_NAME_PREFIX "BTree",
(PyObject *)&BTreeType) < 0)
return;
- if (PyDict_SetItemString(d, MOD_NAME_PREFIX "Set",
+ if (PyDict_SetItemString(d, MOD_NAME_PREFIX "Set",
(PyObject *)&SetType) < 0)
return;
- if (PyDict_SetItemString(d, MOD_NAME_PREFIX "TreeSet",
+ if (PyDict_SetItemString(d, MOD_NAME_PREFIX "TreeSet",
(PyObject *)&TreeSetType) < 0)
return;
}