mirror of
https://github.com/systemd/systemd.git
synced 2025-03-13 00:58:27 +03:00
varlink: yet another fix around handling of IDL comments
Skip over them when validating a message against the IDL. Add test case that tests this.
This commit is contained in:
parent
50df39f2dc
commit
bed73f32ac
@ -1782,6 +1782,9 @@ static int varlink_idl_validate_symbol(const VarlinkSymbol *symbol, sd_json_vari
|
||||
|
||||
for (const VarlinkField *field = symbol->fields; field->field_type != _VARLINK_FIELD_TYPE_END_MARKER; field++) {
|
||||
|
||||
if (field->field_type == _VARLINK_FIELD_COMMENT)
|
||||
continue;
|
||||
|
||||
assert(field->field_type == VARLINK_ENUM_VALUE);
|
||||
|
||||
if (streq_ptr(field->name, s)) {
|
||||
@ -1810,6 +1813,9 @@ static int varlink_idl_validate_symbol(const VarlinkSymbol *symbol, sd_json_vari
|
||||
|
||||
for (const VarlinkField *field = symbol->fields; field->field_type != _VARLINK_FIELD_TYPE_END_MARKER; field++) {
|
||||
|
||||
if (field->field_type == _VARLINK_FIELD_COMMENT)
|
||||
continue;
|
||||
|
||||
if (field->field_direction != direction)
|
||||
continue;
|
||||
|
||||
|
@ -279,7 +279,11 @@ TEST(validate_json) {
|
||||
/* This one has (nested) enonymous enums and structs */
|
||||
static const char text[] =
|
||||
"interface validate.test\n"
|
||||
"method Mymethod ( a:string, b:int, c:?bool, d:[]int, e:?[string]bool, f:?(piff, paff), g:(f:float) ) -> ()\n";
|
||||
"method Mymethod ( \n"
|
||||
"# piff \n"
|
||||
"a:string,\n"
|
||||
"#paff\n"
|
||||
"b:int, c:?bool, d:[]int, e:?[string]bool, f:?(piff, paff), g:(f:float) ) -> ()\n";
|
||||
|
||||
assert_se(varlink_idl_parse(text, NULL, NULL, &parsed) >= 0);
|
||||
test_parse_format_one(parsed);
|
||||
|
Loading…
x
Reference in New Issue
Block a user