Skip to content

Commit

Permalink
Fix "oneliner" durability_service specification
Browse files Browse the repository at this point in the history
It relied on slashes as separators between the various fields but failed to accept a slash
as a terminator for a single value, making it impossible to specify the resource limits.

Signed-off-by: Erik Boasson <[email protected]>
  • Loading branch information
eboasson committed Aug 22, 2024
1 parent 9051f4d commit 41b1abb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/core/ddsc/tests/test_oneliner.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,15 @@ static bool read_kvarg_3len (struct oneliner_lex *l, void *dst)
return true;
}

static bool read_kvarg_isterm (struct oneliner_lex *l2)
{
int tok = peektok (l2, NULL);
return tok == ',' || tok == ')' || tok == '/';
}

static bool read_kvarg (const struct kvarg *ks, size_t sizeof_ks, struct oneliner_lex *l, int *v, void *arg)
{
// l points at name, *inp is , or ) terminated; *l unchanged when false
// l points at name, *inp is , or / or ) terminated; *l unchanged when false
const struct kvarg *kend = ks + sizeof_ks / sizeof (*ks);
struct oneliner_lex l1 = *l;
advancetok (&l1);
Expand All @@ -525,7 +531,7 @@ static bool read_kvarg (const struct kvarg *ks, size_t sizeof_ks, struct oneline
{
assert (k->arg != 0 && k->def == 0);
struct oneliner_lex l2 = l1;
if (k->arg (&l2, arg) && (peektok (&l2, NULL) == ',' || peektok (&l2, NULL) == ')'))
if (k->arg (&l2, arg) && read_kvarg_isterm (&l2))
{
*l = l2;
return true;
Expand All @@ -540,7 +546,7 @@ static bool read_kvarg (const struct kvarg *ks, size_t sizeof_ks, struct oneline
/* skip symbol */
struct oneliner_lex l2 = l1;
l2.inp += k->klen;
if (peektok (&l2, NULL) == ',' || peektok (&l2, NULL) == ')')
if (read_kvarg_isterm (&l2))
{
if (k->arg == 0 || k->def != 0)
{
Expand All @@ -551,7 +557,7 @@ static bool read_kvarg (const struct kvarg *ks, size_t sizeof_ks, struct oneline
}
else if (k->arg != 0 && nexttok (&l2, NULL) == ':')
{
if (k->arg (&l2, arg) && (peektok (&l2, NULL) == ',' || peektok (&l2, NULL) == ')'))
if (k->arg (&l2, arg) && read_kvarg_isterm (&l2))
{
*l = l2;
return true;
Expand Down

0 comments on commit 41b1abb

Please sign in to comment.