platform/trivial: move code in nm-platform.c

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2014-08-11 21:32:47 +02:00
parent 3744544920
commit fa18bd6e0a

View file

@ -1448,6 +1448,27 @@ nm_platform_mesh_set_ssid (int ifindex, const guint8 *ssid, gsize len)
return klass->mesh_set_ssid (platform, ifindex, ssid, len);
}
#define TO_STRING_DEV_BUF_SIZE (5+15+1)
static void
_to_string_dev (int ifindex, char *buf, size_t size)
{
g_assert (buf && size >= TO_STRING_DEV_BUF_SIZE);
if (ifindex) {
const char *name = ifindex > 0 ? nm_platform_link_get_name (ifindex) : NULL;
strcpy (buf, " dev ");
buf += 5;
size -= 5;
if (name)
g_strlcpy (buf, name, size);
else
g_snprintf (buf, size, "%d", ifindex);
} else
buf[0] = 0;
}
/******************************************************************/
GArray *
@ -2132,27 +2153,6 @@ source_to_string (NMPlatformSource source)
return "unknown";
}
#define TO_STRING_DEV_BUF_SIZE (5+15+1)
static void
_to_string_dev (int ifindex, char *buf, size_t size)
{
g_assert (buf && size >= TO_STRING_DEV_BUF_SIZE);
if (ifindex){
const char *name = ifindex > 0 ? nm_platform_link_get_name (ifindex) : NULL;
strcpy (buf, " dev ");
buf += 5;
size -= 5;
if (name)
g_strlcpy (buf, name, size);
else
g_snprintf (buf, size, "%d", ifindex);
} else
buf[0] = 0;
}
static const char *
_lifetime_to_string (guint32 timestamp, guint32 lifetime, gint32 now, char *buf, size_t buf_size)
{