about summary refs log tree commit diff
path: root/src/libnm-core-aux-intern
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2022-01-13 22:30:39 +0100
committerMichael Biebl <biebl@debian.org>2022-01-13 22:30:39 +0100
commit88c227d90a6b7b388c5c85d72802a0ca8f05ed5c (patch)
tree71f32df6617802270e8a78574bd8e1637dc532f4 /src/libnm-core-aux-intern
parente74c568b07b50b97873fb4ee1d776dedefbd54d6 (diff)
New upstream version 1.34.0 upstream/1.34.0
Diffstat (limited to 'src/libnm-core-aux-intern')
-rw-r--r--src/libnm-core-aux-intern/nm-libnm-core-utils.c22
-rw-r--r--src/libnm-core-aux-intern/nm-libnm-core-utils.h5
2 files changed, 26 insertions, 1 deletions
diff --git a/src/libnm-core-aux-intern/nm-libnm-core-utils.c b/src/libnm-core-aux-intern/nm-libnm-core-utils.c
index e53f840a..e1688859 100644
--- a/src/libnm-core-aux-intern/nm-libnm-core-utils.c
+++ b/src/libnm-core-aux-intern/nm-libnm-core-utils.c
@@ -8,13 +8,14 @@
 
 #include "nm-common-macros.h"
 #include "nm-errors.h"
+#include "libnm-core-public/nm-connection.h"
 
 /*****************************************************************************/
 
 const char **
 nm_utils_bond_option_arp_ip_targets_split(const char *arp_ip_target)
 {
-    return nm_utils_strsplit_set_full(arp_ip_target, ",", NM_UTILS_STRSPLIT_SET_FLAGS_STRSTRIP);
+    return nm_strsplit_set_full(arp_ip_target, ",", NM_STRSPLIT_SET_FLAGS_STRSTRIP);
 }
 
 void
@@ -358,3 +359,22 @@ nm_settings_connection_validate_permission_user(const char *item, gssize len)
 
     return TRUE;
 }
+
+gpointer
+_nm_connection_ensure_setting(NMConnection *connection, GType gtype)
+{
+    return nm_connection_get_setting(connection, gtype)
+               ?: _nm_connection_new_setting(connection, gtype);
+}
+
+gpointer
+_nm_connection_new_setting(NMConnection *connection, GType gtype)
+{
+    NMSetting *setting;
+
+    nm_assert(g_type_is_a(gtype, NM_TYPE_SETTING));
+
+    setting = g_object_new(gtype, NULL);
+    nm_connection_add_setting(connection, setting);
+    return setting;
+}
diff --git a/src/libnm-core-aux-intern/nm-libnm-core-utils.h b/src/libnm-core-aux-intern/nm-libnm-core-utils.h
index e0a6aaf1..f90e3984 100644
--- a/src/libnm-core-aux-intern/nm-libnm-core-utils.h
+++ b/src/libnm-core-aux-intern/nm-libnm-core-utils.h
@@ -166,4 +166,9 @@ gboolean nm_utils_validate_dhcp4_vendor_class_id(const char *vci, GError **error
 
 gboolean nm_settings_connection_validate_permission_user(const char *item, gssize len);
 
+/*****************************************************************************/
+
+gpointer _nm_connection_ensure_setting(NMConnection *connection, GType gtype);
+gpointer _nm_connection_new_setting(NMConnection *connection, GType gtype);
+
 #endif /* __NM_LIBNM_SHARED_UTILS_H__ */