Skip to content

Commit

Permalink
Make configuration validation function return validation error message
Browse files Browse the repository at this point in the history
  • Loading branch information
danghai committed Mar 27, 2018
1 parent 16f9a71 commit 89e2e02
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/tlog/play_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ tlog_play_conf_load(struct tlog_errs **perrs,
assert(pcmd_help != NULL);
assert(pconf != NULL);
assert(argv != NULL);
/* Check validate the config */
assert(tlog_play_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
TLOG_RC_OK);

/* Create empty config */
conf = json_object_new_object();
Expand Down Expand Up @@ -136,6 +139,10 @@ tlog_play_conf_load(struct tlog_errs **perrs,
json_object_put(overlay);
overlay = NULL;

/* Check validate the config */
assert(tlog_play_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
TLOG_RC_OK);

grc = TLOG_RC_OK;
*pcmd_help = cmd_help;
cmd_help = NULL;
Expand Down
7 changes: 7 additions & 0 deletions lib/tlog/rec_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ tlog_rec_conf_load(struct tlog_errs **perrs,
assert(pcmd_help != NULL);
assert(pconf != NULL);
assert(argv != NULL);
/* Check validate the config */
assert(tlog_rec_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
TLOG_RC_OK);

/* Create empty config */
conf = json_object_new_object();
Expand Down Expand Up @@ -250,6 +253,10 @@ tlog_rec_conf_load(struct tlog_errs **perrs,
json_object_put(overlay);
overlay = NULL;

/* Check validate the config */
assert(tlog_rec_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
TLOG_RC_OK);

grc = TLOG_RC_OK;
*pcmd_help = cmd_help;
cmd_help = NULL;
Expand Down
7 changes: 7 additions & 0 deletions lib/tlog/rec_session_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ tlog_rec_session_conf_load(struct tlog_errs **perrs,
assert(pcmd_help != NULL);
assert(pconf != NULL);
assert(argv != NULL);
/* Check validate the config */
assert(tlog_rec_session_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
TLOG_RC_OK);

/* Create empty config */
conf = json_object_new_object();
Expand Down Expand Up @@ -265,6 +268,10 @@ tlog_rec_session_conf_load(struct tlog_errs **perrs,
json_object_put(overlay);
overlay = NULL;

/* Check validate the config */
assert(tlog_rec_session_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
TLOG_RC_OK);

grc = TLOG_RC_OK;
*pcmd_help = cmd_help;
cmd_help = NULL;
Expand Down

0 comments on commit 89e2e02

Please sign in to comment.