mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 10:39:23 +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 <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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user