diff --git a/shared/nm-glib-aux/nm-shared-utils.c b/shared/nm-glib-aux/nm-shared-utils.c index 5bab4bd2f2..5f5f41ae2e 100644 --- a/shared/nm-glib-aux/nm-shared-utils.c +++ b/shared/nm-glib-aux/nm-shared-utils.c @@ -5136,6 +5136,31 @@ nm_utils_g_main_context_create_integrate_source(GMainContext *inner_context) 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 nm_utils_ifname_valid_kernel(const char *name, GError **error) { diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h index abcb20abaf..a78682f6a1 100644 --- a/shared/nm-glib-aux/nm-shared-utils.h +++ b/shared/nm-glib-aux/nm-shared-utils.h @@ -2279,6 +2279,8 @@ void nm_indirect_g_free(gpointer arg); /*****************************************************************************/ +void nm_utils_ifname_cpy(char *dst, const char *name); + typedef enum { NMU_IFACE_ANY, NMU_IFACE_KERNEL, diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c index 7b62968fb5..660f6f4317 100644 --- a/src/nm-core-utils.c +++ b/src/nm-core-utils.c @@ -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 * on the new timestamp @now. diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h index c90daaa683..f4fe5f673c 100644 --- a/src/nm-core-utils.h +++ b/src/nm-core-utils.h @@ -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_ifname_cpy(char *dst, const char *name); - guint32 nm_utils_lifetime_rebase_relative_time_on_now(guint32 timestamp, guint32 duration, gint32 now);