sd-varlink: make ret optional in sd_varlink_idl_parse()
We have a test failure where the testsuite is calling sd_varlink_idl_parse() with *ret being NULL. This is now an assert error. So we could either fix the test or fix the code Given that it seems genuinely useful to run sd_varlink_idl_parse() without *ret to e.g. just check if the idl is valid I opted to fix the code.
This commit is contained in:
@@ -1173,7 +1173,7 @@ _public_ int sd_varlink_idl_parse(
|
||||
_cleanup_(sd_varlink_interface_freep) sd_varlink_interface *interface = NULL;
|
||||
_cleanup_(varlink_symbol_freep) sd_varlink_symbol *symbol = NULL;
|
||||
|
||||
assert_return(ret, -EINVAL);
|
||||
POINTER_MAY_BE_NULL(ret);
|
||||
|
||||
enum {
|
||||
STATE_PRE_INTERFACE,
|
||||
@@ -1410,7 +1410,8 @@ _public_ int sd_varlink_idl_parse(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
*ret = TAKE_PTR(interface);
|
||||
if (ret)
|
||||
*ret = TAKE_PTR(interface);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user