Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
6ca375fa
Commit
6ca375fa
authored
Jun 17, 2002
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BTree_grow(): semantically neutral edits, to reduce the differences
between the Zope2 and Zope3 versions.
parent
84ace7a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
src/BTrees/BTreeTemplate.c
src/BTrees/BTreeTemplate.c
+13
-11
No files found.
src/BTrees/BTreeTemplate.c
View file @
6ca375fa
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
****************************************************************************/
****************************************************************************/
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.5
5 2002/06/17 16:42:2
9 tim_one Exp $\n"
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.5
6 2002/06/17 18:26:3
9 tim_one Exp $\n"
/*
/*
** _BTree_get
** _BTree_get
...
@@ -183,28 +183,30 @@ static int
...
@@ -183,28 +183,30 @@ static int
BTree_grow
(
BTree
*
self
,
int
index
,
int
noval
)
BTree_grow
(
BTree
*
self
,
int
index
,
int
noval
)
{
{
int
i
;
int
i
;
Sized
*
v
,
*
e
=
0
;
Sized
*
v
,
*
e
=
0
;
BTreeItem
*
d
;
BTreeItem
*
d
;
if
(
self
->
len
==
self
->
size
)
if
(
self
->
len
==
self
->
size
)
{
{
if
(
self
->
size
)
if
(
self
->
size
)
{
{
UNLESS
(
d
=
PyRealloc
(
self
->
data
,
sizeof
(
BTreeItem
)
*
self
->
size
*
2
))
d
=
PyRealloc
(
self
->
data
,
sizeof
(
BTreeItem
)
*
self
->
size
*
2
);
if
(
d
==
NULL
)
return
-
1
;
return
-
1
;
self
->
data
=
d
;
self
->
data
=
d
;
self
->
size
*=
2
;
self
->
size
*=
2
;
}
}
else
else
{
{
UNLESS
(
d
=
PyMalloc
(
sizeof
(
BTreeItem
)
*
2
))
d
=
PyMalloc
(
sizeof
(
BTreeItem
)
*
2
);
if
(
d
==
NULL
)
return
-
1
;
return
-
1
;
self
->
data
=
d
;
self
->
data
=
d
;
self
->
size
=
2
;
self
->
size
=
2
;
}
}
}
}
d
=
self
->
data
+
index
;
d
=
self
->
data
+
index
;
if
(
self
->
len
)
if
(
self
->
len
)
{
{
v
=
d
->
child
;
v
=
d
->
child
;
...
@@ -221,11 +223,11 @@ BTree_grow(BTree *self, int index, int noval)
...
@@ -221,11 +223,11 @@ BTree_grow(BTree *self, int index, int noval)
/* Now split between the original (v) and the new (e) at the midpoint*/
/* Now split between the original (v) and the new (e) at the midpoint*/
if
(
SameType_Check
(
self
,
v
))
if
(
SameType_Check
(
self
,
v
))
{
{
i
=
BTree_split
(
BTREE
(
v
),
-
1
,
BTREE
(
e
));
i
=
BTree_split
(
BTREE
(
v
),
-
1
,
BTREE
(
e
));
}
}
else
else
{
{
i
=
bucket_split
(
BUCKET
(
v
),
-
1
,
BUCKET
(
e
));
i
=
bucket_split
(
BUCKET
(
v
),
-
1
,
BUCKET
(
e
));
}
}
PER_ALLOW_DEACTIVATION
(
v
);
PER_ALLOW_DEACTIVATION
(
v
);
...
@@ -254,7 +256,7 @@ BTree_grow(BTree *self, int index, int noval)
...
@@ -254,7 +256,7 @@ BTree_grow(BTree *self, int index, int noval)
COPY_KEY
(
d
->
key
,
BUCKET
(
e
)
->
keys
[
0
]);
COPY_KEY
(
d
->
key
,
BUCKET
(
e
)
->
keys
[
0
]);
INCREF_KEY
(
d
->
key
);
INCREF_KEY
(
d
->
key
);
}
}
d
->
child
=
e
;
d
->
child
=
e
;
self
->
len
++
;
self
->
len
++
;
...
@@ -272,7 +274,7 @@ BTree_grow(BTree *self, int index, int noval)
...
@@ -272,7 +274,7 @@ BTree_grow(BTree *self, int index, int noval)
d
->
child
=
SIZED
(
PyObject_CallObject
(
OBJECT
(
&
BucketType
),
NULL
));
d
->
child
=
SIZED
(
PyObject_CallObject
(
OBJECT
(
&
BucketType
),
NULL
));
UNLESS
(
d
->
child
)
return
-
1
;
UNLESS
(
d
->
child
)
return
-
1
;
}
}
self
->
len
=
1
;
self
->
len
=
1
;
Py_INCREF
(
d
->
child
);
Py_INCREF
(
d
->
child
);
self
->
firstbucket
=
BUCKET
(
d
->
child
);
self
->
firstbucket
=
BUCKET
(
d
->
child
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment