Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
58cb5227
Commit
58cb5227
authored
May 30, 2002
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backed off fix made in 1.27, which seems to cause intermittent core
dumps. Copied source from 1.26.
parent
d27d3a6d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
55 deletions
+39
-55
src/BTrees/BTreeTemplate.c
src/BTrees/BTreeTemplate.c
+39
-55
No files found.
src/BTrees/BTreeTemplate.c
View file @
58cb5227
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
****************************************************************************/
****************************************************************************/
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.2
8 2002/05/30 18:29:59 jeremy
Exp $\n"
#define BTREETEMPLATE_C "$Id: BTreeTemplate.c,v 1.2
9 2002/05/30 21:47:39 jim
Exp $\n"
/*
/*
** _BTree_get
** _BTree_get
...
@@ -356,9 +356,7 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
...
@@ -356,9 +356,7 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
}
}
}
}
/* Binary search to find insertion point.
/* Binary search to find insertion point */
min will be set to the index of the child that might have the key.
*/
for
(
min
=
0
,
max
=
self
->
len
,
i
=
max
/
2
;
max
-
min
>
1
;
i
=
(
max
+
min
)
/
2
)
for
(
min
=
0
,
max
=
self
->
len
,
i
=
max
/
2
;
max
-
min
>
1
;
i
=
(
max
+
min
)
/
2
)
{
{
d
=
self
->
data
+
i
;
d
=
self
->
data
+
i
;
...
@@ -372,26 +370,20 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
...
@@ -372,26 +370,20 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
else
max
=
i
;
else
max
=
i
;
}
}
d
=
self
->
data
+
min
;
/* Get item */
d
=
self
->
data
+
min
;
if
(
SameType_Check
(
self
,
d
->
value
))
/* Child is a BTree */
if
(
SameType_Check
(
self
,
d
->
value
))
grew
=
_BTree_set
(
BTREE
(
d
->
value
),
keyarg
,
value
,
unique
,
noval
);
grew
=
_BTree_set
(
BTREE
(
d
->
value
),
keyarg
,
value
,
unique
,
noval
);
else
/* Child is a bucket */
else
grew
=
_bucket_set
(
BUCKET
(
d
->
value
),
keyarg
,
value
,
unique
,
noval
,
grew
=
_bucket_set
(
BUCKET
(
d
->
value
),
keyarg
,
value
,
unique
,
noval
,
&
bchanged
);
&
bchanged
);
if
(
grew
<
0
)
goto
err
;
if
(
grew
<
0
)
goto
err
;
/* grew >0 if we changed the length of the BTree.
If we got smaller and a bucket got deleted, then
grew might be >1 to indicate that we need to adjust previous
bucket pointers, if we can.
*/
if
(
grew
)
if
(
grew
)
{
{
bchanged
=
1
;
/* A bucket changed size */
bchanged
=
1
;
/* A bucket changed size */
if
(
value
)
/* got bigger, check for max size exceeded
*/
if
(
value
)
/* got bigger
*/
{
{
if
(
SameType_Check
(
self
,
d
->
value
))
/* BTree */
if
(
SameType_Check
(
self
,
d
->
value
))
{
{
if
(
BTREE
(
d
->
value
)
->
len
>
MAX_BTREE_SIZE
(
d
->
value
))
if
(
BTREE
(
d
->
value
)
->
len
>
MAX_BTREE_SIZE
(
d
->
value
))
{
{
...
@@ -399,7 +391,7 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
...
@@ -399,7 +391,7 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
changed
=
1
;
changed
=
1
;
}
}
}
}
else
/* Bucket */
else
{
{
if
(
BUCKET
(
d
->
value
)
->
len
>
MAX_BUCKET_SIZE
(
d
->
value
))
if
(
BUCKET
(
d
->
value
)
->
len
>
MAX_BUCKET_SIZE
(
d
->
value
))
{
{
...
@@ -449,17 +441,7 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
...
@@ -449,17 +441,7 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
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
));
changed
=
1
;
if
(
!
min
)
}
if
(
min
==
0
&&
grew
>
1
)
/* The first bucket got deleted by us or a child.
If grew is > 1 then either we deleted the first one and
incremented grew ourself (just above) or
a child deleted it's first bucket and nobody could
adjust the pervious bucket's pointer, because there
were no previous buckets. Thus, it *must* be the first!
*/
{
{
if
(
self
->
len
)
if
(
self
->
len
)
{
/* We just deleted our first child, so we need to
{
/* We just deleted our first child, so we need to
...
@@ -489,6 +471,8 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
...
@@ -489,6 +471,8 @@ _BTree_set(BTree *self, PyObject *keyarg, PyObject *value,
}
}
}
}
changed
=
1
;
}
}
}
}
}
...
...
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