Skip to content

Commit 89e2e02

Browse files
author
danghai
committed
Make configuration validation function return validation error message
1 parent 16f9a71 commit 89e2e02

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

lib/tlog/play_conf.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ tlog_play_conf_load(struct tlog_errs **perrs,
7575
assert(pcmd_help != NULL);
7676
assert(pconf != NULL);
7777
assert(argv != NULL);
78+
/* Check validate the config */
79+
assert(tlog_play_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
80+
TLOG_RC_OK);
7881

7982
/* Create empty config */
8083
conf = json_object_new_object();
@@ -136,6 +139,10 @@ tlog_play_conf_load(struct tlog_errs **perrs,
136139
json_object_put(overlay);
137140
overlay = NULL;
138141

142+
/* Check validate the config */
143+
assert(tlog_play_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
144+
TLOG_RC_OK);
145+
139146
grc = TLOG_RC_OK;
140147
*pcmd_help = cmd_help;
141148
cmd_help = NULL;

lib/tlog/rec_conf.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ tlog_rec_conf_load(struct tlog_errs **perrs,
175175
assert(pcmd_help != NULL);
176176
assert(pconf != NULL);
177177
assert(argv != NULL);
178+
/* Check validate the config */
179+
assert(tlog_rec_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
180+
TLOG_RC_OK);
178181

179182
/* Create empty config */
180183
conf = json_object_new_object();
@@ -250,6 +253,10 @@ tlog_rec_conf_load(struct tlog_errs **perrs,
250253
json_object_put(overlay);
251254
overlay = NULL;
252255

256+
/* Check validate the config */
257+
assert(tlog_rec_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
258+
TLOG_RC_OK);
259+
253260
grc = TLOG_RC_OK;
254261
*pcmd_help = cmd_help;
255262
cmd_help = NULL;

lib/tlog/rec_session_conf.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ tlog_rec_session_conf_load(struct tlog_errs **perrs,
189189
assert(pcmd_help != NULL);
190190
assert(pconf != NULL);
191191
assert(argv != NULL);
192+
/* Check validate the config */
193+
assert(tlog_rec_session_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
194+
TLOG_RC_OK);
192195

193196
/* Create empty config */
194197
conf = json_object_new_object();
@@ -265,6 +268,10 @@ tlog_rec_session_conf_load(struct tlog_errs **perrs,
265268
json_object_put(overlay);
266269
overlay = NULL;
267270

271+
/* Check validate the config */
272+
assert(tlog_rec_session_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
273+
TLOG_RC_OK);
274+
268275
grc = TLOG_RC_OK;
269276
*pcmd_help = cmd_help;
270277
cmd_help = NULL;

0 commit comments

Comments
 (0)