]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: cfgparse: add two new functions to check arguments count
authorWilly Tarreau <w@1wt.eu>
Wed, 21 Dec 2016 21:41:44 +0000 (22:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 21 Dec 2016 22:39:26 +0000 (23:39 +0100)
commitece9b07c7190b58dbaf1bc36c695a2ca8e4ec0cc
tree27a3d999094c00047615c37aaac36da4de7f0221
parentbee9dde31fa34a36fb1b6701042658295b744259
MINOR: cfgparse: add two new functions to check arguments count

We already had alertif_too_many_args{,_idx}(), but these ones are
specifically designed for use in cfgparse. Outside of it we're
trying to avoid calling Alert() all the time so we need an
equivalent using a pointer to an error message.

These new functions called too_many_args{,_idx)() do exactly this.
They don't take the file name nor the line number which they have
no use for but instead they take an optional pointer to an error
message and the pointer to the error code is optional as well.
With (NULL, NULL) they'll simply check the validity and return a
verdict. They are quite convenient for use in isolated keyword
parsers.

These two new functions as well as the previous ones have all been
exported.
include/common/cfgparse.h
src/cfgparse.c