mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 02:19:26 +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:
parent
23799d0cb4
commit
d702e037c0
25
src/main.c
25
src/main.c
@ -31,6 +31,8 @@
|
||||
#include <signal.h>
|
||||
#include <ell/ell.h>
|
||||
|
||||
#include <ell/useful.h>
|
||||
|
||||
#include "linux/nl80211.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,
|
||||
void *user_data)
|
||||
{
|
||||
struct l_dbus_message *reply;
|
||||
struct l_dbus_message_builder *builder;
|
||||
L_AUTO_FREE_VAR(char *, storage_dir) = storage_get_path(NULL);
|
||||
bool b = netconfig_enabled();
|
||||
struct l_dbus_message *reply =
|
||||
l_dbus_message_new_method_return(message);
|
||||
_auto_(l_free) char *storage_dir = storage_get_path(NULL);
|
||||
|
||||
reply = l_dbus_message_new_method_return(message);
|
||||
builder = l_dbus_message_builder_new(reply);
|
||||
l_dbus_message_builder_enter_array(builder, "{sv}");
|
||||
|
||||
dbus_append_dict_basic(builder, "NetworkConfigurationEnabled", 'b', &b);
|
||||
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);
|
||||
l_dbus_message_set_arguments(reply, "a{sv}", 3,
|
||||
"NetworkConfigurationEnabled",
|
||||
"b", netconfig_enabled(),
|
||||
"StateDirectory", "s", storage_dir,
|
||||
"Version", "s", VERSION);
|
||||
|
||||
return reply;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user