1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-02-14 19:42:01 +00:00

miracled: move peer_make_name() definition

Move peer_make_name() to the top to keep consistency with miracled-link.c
and move non-object-based helpers to the top.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
This commit is contained in:
David Herrmann 2014-02-10 14:22:33 +01:00
parent 4879057c01
commit 7457a7cf90

View file

@ -33,6 +33,23 @@
#include "miracled-wifi.h"
#include "shl_log.h"
int peer_make_name(unsigned int id, char **out)
{
char buf[64] = { };
char *name;
if (!out)
return 0;
snprintf(buf, sizeof(buf) - 1, "%u", id);
name = sd_bus_label_escape(buf);
if (!name)
return log_ENOMEM();
*out = name;
return 0;
}
static int peer_new(struct link *l, struct peer **out)
{
unsigned int id;
@ -140,20 +157,3 @@ void peer_process_wifi(struct peer *p, struct wifi_event *ev)
break;
}
}
int peer_make_name(unsigned int id, char **out)
{
char buf[64] = { };
char *name;
if (!out)
return 0;
snprintf(buf, sizeof(buf) - 1, "%u", id);
name = sd_bus_label_escape(buf);
if (!name)
return log_ENOMEM();
*out = name;
return 0;
}