3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 14:49:24 +01:00

main: Simplify away l_dbus_message_builder use

Since the dictionary attributes are static, l_dbus_message_set_arguments
can be used instead.
This commit is contained in:
Denis Kenzior 2021-10-22 10:47:59 -05:00
parent 23799d0cb4
commit d702e037c0

View File

@ -31,6 +31,8 @@
#include <signal.h> #include <signal.h>
#include <ell/ell.h> #include <ell/ell.h>
#include <ell/useful.h>
#include "linux/nl80211.h" #include "linux/nl80211.h"
#include "src/iwd.h" #include "src/iwd.h"
@ -215,22 +217,15 @@ static struct l_dbus_message *iwd_dbus_get_info(struct l_dbus *dbus,
struct l_dbus_message *message, struct l_dbus_message *message,
void *user_data) void *user_data)
{ {
struct l_dbus_message *reply; struct l_dbus_message *reply =
struct l_dbus_message_builder *builder; l_dbus_message_new_method_return(message);
L_AUTO_FREE_VAR(char *, storage_dir) = storage_get_path(NULL); _auto_(l_free) char *storage_dir = storage_get_path(NULL);
bool b = netconfig_enabled();
reply = l_dbus_message_new_method_return(message); l_dbus_message_set_arguments(reply, "a{sv}", 3,
builder = l_dbus_message_builder_new(reply); "NetworkConfigurationEnabled",
l_dbus_message_builder_enter_array(builder, "{sv}"); "b", netconfig_enabled(),
"StateDirectory", "s", storage_dir,
dbus_append_dict_basic(builder, "NetworkConfigurationEnabled", 'b', &b); "Version", "s", VERSION);
dbus_append_dict_basic(builder, "StateDirectory", 's', storage_dir);
dbus_append_dict_basic(builder, "Version", 's', VERSION);
l_dbus_message_builder_leave_array(builder);
l_dbus_message_builder_finalize(builder);
l_dbus_message_builder_destroy(builder);
return reply; return reply;
} }