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
d0d2f517
Commit
d0d2f517
authored
13 years ago
by
Dmitry Simonenko
Browse files
Options
Downloads
Patches
Plain Diff
error-injection: review fixes
parent
9ae06afc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/errinj.m
+7
-5
7 additions, 5 deletions
core/errinj.m
include/errinj.h
+3
-9
3 additions, 9 deletions
include/errinj.h
with
10 additions
and
14 deletions
core/errinj.m
+
7
−
5
View file @
d0d2f517
...
...
@@ -49,13 +49,15 @@ struct errinj errinjs[errinj_enum_MAX] = {
* @return error injection handle state on success, false on error.
*/
bool
errinj_
state
(int id)
errinj_
get
(int id)
{
assert(id >= 0
&&
id
<
errinj_enum_MAX
);
return
errinjs
[
id
].
state
;
}
static
struct
errinj
*errinj_match
(
char
*name
)
{
static
struct
errinj
*
errinj_lookup
(
char
*name
)
{
int
i
;
for
(i =
0
;
i
<
errinj_enum_MAX
;
i
++)
{
if
(
strcmp
(
errinjs
[
i
].
name
,
name) =
=
0)
...
...
@@ -72,9 +74,9 @@ static struct errinj *errinj_match(char *name) {
*
@
return
error
injection
handle
state
on
success
,
false
on
error.
*
/
bool
errinj_
state
_byname
(
char
*name
)
errinj_
get
_byname
(
char
*name
)
{
struct
errinj
*ei =
errinj_
match
(name);
struct
errinj
*ei =
errinj_
lookup
(name);
if
(ei =
=
NULL
)
return
false
;
return
ei-
>
state;
...
...
@@ -105,7 +107,7 @@ errinj_set(int id, bool state)
bool
errinj_set_byname
(
char
*name
,
bool
state
)
{
struct
errinj
*ei =
errinj_
match
(name);
struct
errinj
*ei =
errinj_
lookup
(name);
if
(ei =
=
NULL
)
return
false
;
ei-
>
state = state;
...
...
This diff is collapsed.
Click to expand it.
include/errinj.h
+
3
−
9
View file @
d0d2f517
...
...
@@ -42,8 +42,8 @@ struct errinj {
ENUM0
(
errinj_enum
,
ERRINJ_LIST
);
extern
struct
errinj
errinjs
[];
bool
errinj_
state
(
int
id
);
bool
errinj_
state
_byname
(
char
*
name
);
bool
errinj_
get
(
int
id
);
bool
errinj_
get
_byname
(
char
*
name
);
void
errinj_set
(
int
id
,
bool
state
);
bool
errinj_set_byname
(
char
*
name
,
bool
state
);
...
...
@@ -56,15 +56,9 @@ void errinj_info(struct tbuf *out);
#else
#define ERROR_INJECT(ID) \
do { \
if (errinj_
state
(ID) == true) \
if (errinj_
get
(ID) == true) \
tnt_raise(ErrorInjection, :#ID); \
} while (0)
#define ERROR_INJECT_BYNAME(NAME) \
do { \
if (errinj_state_byname(NAME) == true) \
tnt_raise(ErrorInjection, :NAME); \
} while (0)
#endif
#endif
/* TATRANTOOL_ERRINJ_H_INCLUDED */
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