Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
f7e8d056
Commit
f7e8d056
authored
12 years ago
by
Roman Tsisyk
Browse files
Options
Downloads
Patches
Plain Diff
BitsetIndex: review fixes
parent
b5567e13
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/box/bitset_index.m
+16
-24
16 additions, 24 deletions
src/box/bitset_index.m
with
16 additions
and
24 deletions
src/box/bitset_index.m
+
16
−
24
View file @
f7e8d056
...
@@ -56,32 +56,32 @@ value_to_tuple(size_t value)
...
@@ -56,32 +56,32 @@ value_to_tuple(size_t value)
return
salloc_ptr_from_index
(
value
);
return
salloc_ptr_from_index
(
value
);
}
}
struct
iterator_wrappe
r
{
struct
bitset_index_iterato
r
{
struct
iterator
base
;
/* Must be the first member. */
struct
iterator
base
;
/* Must be the first member. */
struct
bitset_iterator
bitset_it
;
struct
bitset_iterator
bitset_it
;
};
};
static
struct
iterator_wrappe
r
*
static
struct
bitset_index_iterato
r
*
iterator_wrappe
r
(
struct
iterator
*
it
)
bitset_index_iterato
r
(
struct
iterator
*
it
)
{
{
return
(
struct
iterator_wrappe
r
*
)
it
;
return
(
struct
bitset_index_iterato
r
*
)
it
;
}
}
void
void
iterator_wrappe
r_free
(
struct
iterator
*
iterator
)
bitset_index_iterato
r_free
(
struct
iterator
*
iterator
)
{
{
assert
(
iterator
->
free
==
iterator_wrappe
r_free
);
assert
(
iterator
->
free
==
bitset_index_iterato
r_free
);
struct
iterator_wrapper
*
it
=
iterator_wrappe
r
(
iterator
);
struct
bitset_index_iterator
*
it
=
bitset_index_iterato
r
(
iterator
);
bitset_iterator_destroy
(
&
it
->
bitset_it
);
bitset_iterator_destroy
(
&
it
->
bitset_it
);
free
(
it
);
free
(
it
);
}
}
struct
tuple
*
struct
tuple
*
iterator_wrappe
r_next
(
struct
iterator
*
iterator
)
bitset_index_iterato
r_next
(
struct
iterator
*
iterator
)
{
{
assert
(
iterator
->
free
==
iterator_wrappe
r_free
);
assert
(
iterator
->
free
==
bitset_index_iterato
r_free
);
struct
iterator_wrapper
*
it
=
iterator_wrappe
r
(
iterator
);
struct
bitset_index_iterator
*
it
=
bitset_index_iterato
r
(
iterator
);
size_t
value
=
bitset_iterator_next
(
&
it
->
bitset_it
);
size_t
value
=
bitset_iterator_next
(
&
it
->
bitset_it
);
if
(
value
==
SIZE_MAX
)
if
(
value
==
SIZE_MAX
)
...
@@ -163,13 +163,13 @@ iterator_wrapper_next(struct iterator *iterator)
...
@@ -163,13 +163,13 @@ iterator_wrapper_next(struct iterator *iterator)
-
(
struct
iterator
*
)
allocIterator
-
(
struct
iterator
*
)
allocIterator
{
{
struct
iterator_wrappe
r
*
it
=
malloc
(
sizeof
(
struct
iterator_wrapper
));
struct
bitset_index_iterato
r
*
it
=
malloc
(
sizeof
(
*
it
));
if
(
!
it
)
if
(
!
it
)
return
NULL
;
return
NULL
;
memset
(
it
,
0
,
sizeof
(
struct
iterator_wrapper
));
memset
(
it
,
0
,
sizeof
(
*
it
));
it
->
base
.
next
=
iterator_wrappe
r_next
;
it
->
base
.
next
=
bitset_index_iterato
r_next
;
it
->
base
.
free
=
iterator_wrappe
r_free
;
it
->
base
.
free
=
bitset_index_iterato
r_free
;
bitset_iterator_create
(
&
it
->
bitset_it
,
realloc
);
bitset_iterator_create
(
&
it
->
bitset_it
,
realloc
);
...
@@ -203,10 +203,6 @@ iterator_wrapper_next(struct iterator *iterator)
...
@@ -203,10 +203,6 @@ iterator_wrapper_next(struct iterator *iterator)
if
(
old_tuple
!=
NULL
)
{
if
(
old_tuple
!=
NULL
)
{
size_t
value
=
tuple_to_value
(
old_tuple
);
size_t
value
=
tuple_to_value
(
old_tuple
);
#if defined(DEBUG)
say_debug
(
"BitsetIndex: remove value = %zu (%p)"
,
value
,
old_tuple
);
#endif
/* defined(DEBUG) */
if
(
bitset_index_contains_value
(
&
self
->
index
,
value
))
{
if
(
bitset_index_contains_value
(
&
self
->
index
,
value
))
{
ret
=
old_tuple
;
ret
=
old_tuple
;
...
@@ -223,10 +219,6 @@ iterator_wrapper_next(struct iterator *iterator)
...
@@ -223,10 +219,6 @@ iterator_wrapper_next(struct iterator *iterator)
const
void
*
bitset_key
=
field
;
const
void
*
bitset_key
=
field
;
size_t
value
=
tuple_to_value
(
new_tuple
);
size_t
value
=
tuple_to_value
(
new_tuple
);
#if defined(DEBUG)
say_debug
(
"BitsetIndex: insert value = %zu (%p)"
,
value
,
new_tuple
);
#endif
/* defined(DEBUG) */
if
(
bitset_index_insert
(
&
self
->
index
,
bitset_key
,
if
(
bitset_index_insert
(
&
self
->
index
,
bitset_key
,
bitset_key_size
,
value
)
<
0
)
{
bitset_key_size
,
value
)
<
0
)
{
tnt_raise
(
ClientError
,
:
ER_MEMORY_ISSUE
,
0
,
tnt_raise
(
ClientError
,
:
ER_MEMORY_ISSUE
,
0
,
...
@@ -240,8 +232,8 @@ iterator_wrapper_next(struct iterator *iterator)
...
@@ -240,8 +232,8 @@ iterator_wrapper_next(struct iterator *iterator)
-
(
void
)
initIterator
:
(
struct
iterator
*
)
iterator
:
(
enum
iterator_type
)
type
-
(
void
)
initIterator
:
(
struct
iterator
*
)
iterator
:
(
enum
iterator_type
)
type
:
(
const
void
*
)
key
:
(
u32
)
part_count
:
(
const
void
*
)
key
:
(
u32
)
part_count
{
{
assert
(
iterator
->
free
==
iterator_wrappe
r_free
);
assert
(
iterator
->
free
==
bitset_index_iterato
r_free
);
struct
iterator_wrapper
*
it
=
iterator_wrappe
r
(
iterator
);
struct
bitset_index_iterator
*
it
=
bitset_index_iterato
r
(
iterator
);
const
void
*
bitset_key
=
NULL
;
const
void
*
bitset_key
=
NULL
;
size_t
bitset_key_size
=
0
;
size_t
bitset_key_size
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment