-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make configuration validation function return validation error message #193
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, I only have one style comment.
Also, I think we should add similar assertions at the entry of the functions which accept configuration. Could you see if we can do it? Thanks, Hai!
lib/tlog/play_conf.c
Outdated
/* Check validate the config */ | ||
assert(tlog_play_conf_validate(NULL, | ||
conf, | ||
TLOG_CONF_ORIGIN_ARGS) == TLOG_RC_OK); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you wrap it a bit differently, so it takes less lines? Here and elsewhere? E.g.:
assert(tlog_play_conf_validate(NULL, conf, TLOG_CONF_ORIGIN_ARGS) ==
TLOG_RC_OK);
I have updated it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from the inline comment, this commit subject doesn't make sense. Please figure out what we're doing and why we're doing it and fix the subject.
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wouldn't make sense, we don't need to validate a NULL pointer we just initialized. This function doesn't need to validate the configuration it receives, as it doesn't receive any. The same for the rest of those.
Hi Nick, PR for issue #41 to make configuration validation function return validation error message by using
assert
.