Export section parsing related structures to the top level, and add a function
to convert from a section name to the corresponding section enum. This
allows the section name matching to be modular, via calling the conversion
function on the scanned key instead of chained if statements. It also allows
global properties to be specified to be declared under the "main" section.
config: make section name parsing modular #24
I think getting rid of the chained if-statements is an improvement.
But I don't see much reason to move the section definitions out of the parse_config_file() function; that's the only place they are used, and I like to keep variable scope as tight as possible. (str_to_section() is small enough that I don't see any reason it can't be inline:d in parse_config_file()).
Or do you have more work planned, that depend on this?
You are right, there isn't any point to move the section definitions out to the top level, I basically modelled the config parsing block from foot. I will work on the requested changes.
No, at least not in the short term. I am not super comfortable with C and mainly made this PR to make the section parsing logic more modular as well as to make it easier for the configuration to be serialized to other formats without additional logic for global properties(it is a direct consequence of the first change).
Sorry for my bad english.
6d0cc943d6
to 4540dde327
4540dde327
to 9ddd7c8c31
LGTM!
Thanks!
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?