1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

Merge pull request #15833 from AsamK/busctl_introspect_method_signature

busctl: Add introspect support for methods with same name but different signature
This commit is contained in:
Luca Boccassi 2022-09-06 22:21:39 +01:00 committed by GitHub
commit 844768c78b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -742,6 +742,9 @@ static void member_hash_func(const Member *m, struct siphash *state) {
if (m->name)
string_hash_func(m->name, state);
if (m->signature)
string_hash_func(m->signature, state);
if (m->interface)
string_hash_func(m->interface, state);
}
@ -762,7 +765,11 @@ static int member_compare_func(const Member *x, const Member *y) {
if (d != 0)
return d;
return strcmp_ptr(x->name, y->name);
d = strcmp_ptr(x->name, y->name);
if (d != 0)
return d;
return strcmp_ptr(x->signature, y->signature);
}
static int member_compare_funcp(Member * const *a, Member * const *b) {
@ -809,8 +816,9 @@ static int on_interface(const char *interface, uint64_t flags, void *userdata) {
return log_oom();
r = set_put(members, m);
if (r == -EEXIST)
return log_error_errno(r, "Invalid introspection data: duplicate interface '%s'.", interface);
if (r == 0)
return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
"Invalid introspection data: duplicate interface '%s'.", interface);
if (r < 0)
return log_oom();
@ -852,8 +860,9 @@ static int on_method(const char *interface, const char *name, const char *signat
return log_oom();
r = set_put(members, m);
if (r == -EEXIST)
return log_error_errno(r, "Invalid introspection data: duplicate method '%s' on interface '%s'.", name, interface);
if (r == 0)
return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
"Invalid introspection data: duplicate method '%s' on interface '%s'.", name, interface);
if (r < 0)
return log_oom();
@ -891,8 +900,9 @@ static int on_signal(const char *interface, const char *name, const char *signat
return log_oom();
r = set_put(members, m);
if (r == -EEXIST)
return log_error_errno(r, "Invalid introspection data: duplicate signal '%s' on interface '%s'.", name, interface);
if (r == 0)
return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
"Invalid introspection data: duplicate signal '%s' on interface '%s'.", name, interface);
if (r < 0)
return log_oom();
@ -931,8 +941,9 @@ static int on_property(const char *interface, const char *name, const char *sign
return log_oom();
r = set_put(members, m);
if (r == -EEXIST)
return log_error_errno(r, "Invalid introspection data: duplicate property '%s' on interface '%s'.", name, interface);
if (r == 0)
return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
"Invalid introspection data: duplicate property '%s' on interface '%s'.", name, interface);
if (r < 0)
return log_oom();