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
68d8ccc7
Commit
68d8ccc7
authored
11 years ago
by
Konstantin Osipov
Browse files
Options
Downloads
Patches
Plain Diff
Define mh_key_t in mh_i32ptr_hash to enable mh_find().
parent
02f5afc6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/assoc.h
+4
-1
4 additions, 1 deletion
include/assoc.h
src/box/space.cc
+2
-4
2 additions, 4 deletions
src/box/space.cc
src/fiber.cc
+1
-2
1 addition, 2 deletions
src/fiber.cc
src/session.cc
+1
-2
1 addition, 2 deletions
src/session.cc
with
8 additions
and
9 deletions
include/assoc.h
+
4
−
1
View file @
68d8ccc7
...
@@ -36,14 +36,17 @@
...
@@ -36,14 +36,17 @@
* Map: (i32) => (void *)
* Map: (i32) => (void *)
*/
*/
#define mh_name _i32ptr
#define mh_name _i32ptr
#define mh_key_t uint32_t
struct
mh_i32ptr_node_t
{
struct
mh_i32ptr_node_t
{
uint32
_t
key
;
mh_key
_t
key
;
void
*
val
;
void
*
val
;
};
};
#define mh_node_t struct mh_i32ptr_node_t
#define mh_node_t struct mh_i32ptr_node_t
#define mh_arg_t void *
#define mh_arg_t void *
#define mh_hash(a, arg) (a->key)
#define mh_hash(a, arg) (a->key)
#define mh_hash_key(a, arg) (a)
#define mh_eq(a, b, arg) ((a->key) == (b->key))
#define mh_eq(a, b, arg) ((a->key) == (b->key))
#define mh_eq_key(a, b, arg) ((a) == (b->key))
#include
<mhash.h>
#include
<mhash.h>
This diff is collapsed.
Click to expand it.
src/box/space.cc
+
2
−
4
View file @
68d8ccc7
...
@@ -121,8 +121,7 @@ space_delete(struct space *space)
...
@@ -121,8 +121,7 @@ space_delete(struct space *space)
{
{
if
(
tarantool_L
)
if
(
tarantool_L
)
box_lua_space_delete
(
tarantool_L
,
space
);
box_lua_space_delete
(
tarantool_L
,
space
);
const
struct
mh_i32ptr_node_t
node
=
{
space_id
(
space
),
NULL
};
mh_int_t
k
=
mh_i32ptr_find
(
spaces
,
space_id
(
space
),
NULL
);
mh_int_t
k
=
mh_i32ptr_get
(
spaces
,
&
node
,
NULL
);
assert
(
k
!=
mh_end
(
spaces
));
assert
(
k
!=
mh_end
(
spaces
));
mh_i32ptr_del
(
spaces
,
k
,
NULL
);
mh_i32ptr_del
(
spaces
,
k
,
NULL
);
for
(
uint32_t
j
=
0
;
j
<=
space
->
index_id_max
;
j
++
)
for
(
uint32_t
j
=
0
;
j
<=
space
->
index_id_max
;
j
++
)
...
@@ -134,8 +133,7 @@ space_delete(struct space *space)
...
@@ -134,8 +133,7 @@ space_delete(struct space *space)
struct
space
*
struct
space
*
space_by_id
(
uint32_t
id
)
space_by_id
(
uint32_t
id
)
{
{
const
struct
mh_i32ptr_node_t
node
=
{
id
,
NULL
};
mh_int_t
space
=
mh_i32ptr_find
(
spaces
,
id
,
NULL
);
mh_int_t
space
=
mh_i32ptr_get
(
spaces
,
&
node
,
NULL
);
if
(
space
==
mh_end
(
spaces
))
if
(
space
==
mh_end
(
spaces
))
return
NULL
;
return
NULL
;
return
(
struct
space
*
)
mh_i32ptr_node
(
spaces
,
space
)
->
val
;
return
(
struct
space
*
)
mh_i32ptr_node
(
spaces
,
space
)
->
val
;
...
...
This diff is collapsed.
Click to expand it.
src/fiber.cc
+
1
−
2
View file @
68d8ccc7
...
@@ -321,8 +321,7 @@ fiber_ready_async(ev_async *watcher, int revents)
...
@@ -321,8 +321,7 @@ fiber_ready_async(ev_async *watcher, int revents)
struct
fiber
*
struct
fiber
*
fiber_find
(
uint32_t
fid
)
fiber_find
(
uint32_t
fid
)
{
{
struct
mh_i32ptr_node_t
node
=
{
fid
,
NULL
};
mh_int_t
k
=
mh_i32ptr_find
(
fiber_registry
,
fid
,
NULL
);
mh_int_t
k
=
mh_i32ptr_get
(
fiber_registry
,
&
node
,
NULL
);
if
(
k
==
mh_end
(
fiber_registry
))
if
(
k
==
mh_end
(
fiber_registry
))
return
NULL
;
return
NULL
;
...
...
This diff is collapsed.
Click to expand it.
src/session.cc
+
1
−
2
View file @
68d8ccc7
...
@@ -93,8 +93,7 @@ session_destroy(uint32_t sid)
...
@@ -93,8 +93,7 @@ session_destroy(uint32_t sid)
int
int
session_fd
(
uint32_t
sid
)
session_fd
(
uint32_t
sid
)
{
{
struct
mh_i32ptr_node_t
node
=
{
sid
,
NULL
};
mh_int_t
k
=
mh_i32ptr_find
(
session_registry
,
sid
,
NULL
);
mh_int_t
k
=
mh_i32ptr_get
(
session_registry
,
&
node
,
NULL
);
return
k
==
mh_end
(
session_registry
)
?
return
k
==
mh_end
(
session_registry
)
?
-
1
:
(
intptr_t
)
mh_i32ptr_node
(
session_registry
,
k
)
->
val
;
-
1
:
(
intptr_t
)
mh_i32ptr_node
(
session_registry
,
k
)
->
val
;
}
}
...
...
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