mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 11:19:16 +02:00
shared: move nm_utils_ifname_cpy() to "shared/nm-glib-aux"
This commit is contained in:
parent
6aa6da2b08
commit
43d4810179
4 changed files with 27 additions and 25 deletions
|
|
@ -5136,6 +5136,31 @@ nm_utils_g_main_context_create_integrate_source(GMainContext *inner_context)
|
||||||
return &ctx_src->source;
|
return &ctx_src->source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
|
nm_utils_ifname_cpy(char *dst, const char *name)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
g_return_if_fail(dst);
|
||||||
|
g_return_if_fail(name && name[0]);
|
||||||
|
|
||||||
|
nm_assert(nm_utils_ifname_valid_kernel(name, NULL));
|
||||||
|
|
||||||
|
/* ensures NUL padding of the entire IFNAMSIZ buffer. */
|
||||||
|
|
||||||
|
for (i = 0; i < (int) IFNAMSIZ && name[i] != '\0'; i++)
|
||||||
|
dst[i] = name[i];
|
||||||
|
|
||||||
|
nm_assert(name[i] == '\0');
|
||||||
|
|
||||||
|
for (; i < (int) IFNAMSIZ; i++)
|
||||||
|
dst[i] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nm_utils_ifname_valid_kernel(const char *name, GError **error)
|
nm_utils_ifname_valid_kernel(const char *name, GError **error)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2279,6 +2279,8 @@ void nm_indirect_g_free(gpointer arg);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void nm_utils_ifname_cpy(char *dst, const char *name);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NMU_IFACE_ANY,
|
NMU_IFACE_ANY,
|
||||||
NMU_IFACE_KERNEL,
|
NMU_IFACE_KERNEL,
|
||||||
|
|
|
||||||
|
|
@ -4269,29 +4269,6 @@ nm_utils_g_value_set_strv(GValue *value, GPtrArray *strings)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void
|
|
||||||
nm_utils_ifname_cpy(char *dst, const char *name)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
g_return_if_fail(dst);
|
|
||||||
g_return_if_fail(name && name[0]);
|
|
||||||
|
|
||||||
nm_assert(nm_utils_ifname_valid_kernel(name, NULL));
|
|
||||||
|
|
||||||
/* ensures NUL padding of the entire IFNAMSIZ buffer. */
|
|
||||||
|
|
||||||
for (i = 0; i < (int) IFNAMSIZ && name[i] != '\0'; i++)
|
|
||||||
dst[i] = name[i];
|
|
||||||
|
|
||||||
nm_assert(name[i] == '\0');
|
|
||||||
|
|
||||||
for (; i < (int) IFNAMSIZ; i++)
|
|
||||||
dst[i] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes a pair @timestamp and @duration, and returns the remaining duration based
|
* Takes a pair @timestamp and @duration, and returns the remaining duration based
|
||||||
* on the new timestamp @now.
|
* on the new timestamp @now.
|
||||||
|
|
|
||||||
|
|
@ -501,8 +501,6 @@ void _nm_utils_set_testing(NMUtilsTestFlags flags);
|
||||||
|
|
||||||
void nm_utils_g_value_set_strv(GValue *value, GPtrArray *strings);
|
void nm_utils_g_value_set_strv(GValue *value, GPtrArray *strings);
|
||||||
|
|
||||||
void nm_utils_ifname_cpy(char *dst, const char *name);
|
|
||||||
|
|
||||||
guint32
|
guint32
|
||||||
nm_utils_lifetime_rebase_relative_time_on_now(guint32 timestamp, guint32 duration, gint32 now);
|
nm_utils_lifetime_rebase_relative_time_on_now(guint32 timestamp, guint32 duration, gint32 now);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue