libnm,cli: move cleanup macros to "shared/nm-libnm-core-utils.h"
This commit is contained in:
@@ -23,13 +23,7 @@
|
|||||||
#include "nm-meta-setting.h"
|
#include "nm-meta-setting.h"
|
||||||
#include "nm-active-connection.h"
|
#include "nm-active-connection.h"
|
||||||
#include "nm-device.h"
|
#include "nm-device.h"
|
||||||
|
#include "nm-libnm-core-utils.h"
|
||||||
|
|
||||||
#define nm_auto_unref_ip_address nm_auto (_nm_ip_address_unref)
|
|
||||||
NM_AUTO_DEFINE_FCN0 (NMIPAddress *, _nm_ip_address_unref, nm_ip_address_unref)
|
|
||||||
|
|
||||||
#define nm_auto_unref_wgpeer nm_auto (_nm_auto_unref_wgpeer)
|
|
||||||
NM_AUTO_DEFINE_FCN0 (NMWireGuardPeer *, _nm_auto_unref_wgpeer, nm_wireguard_peer_unref)
|
|
||||||
|
|
||||||
const NMObject **nmc_objects_sort_by_path (const NMObject *const*objs, gssize len);
|
const NMObject **nmc_objects_sort_by_path (const NMObject *const*objs, gssize len);
|
||||||
|
|
||||||
|
@@ -88,6 +88,7 @@
|
|||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
#include "nm-vpn-dbus-interface.h"
|
#include "nm-vpn-dbus-interface.h"
|
||||||
#include "nm-vpn-editor-plugin.h"
|
#include "nm-vpn-editor-plugin.h"
|
||||||
|
#include "nm-libnm-core-utils.h"
|
||||||
|
|
||||||
/* IEEE 802.1D-1998 timer values */
|
/* IEEE 802.1D-1998 timer values */
|
||||||
#define NM_BR_MIN_HELLO_TIME 1
|
#define NM_BR_MIN_HELLO_TIME 1
|
||||||
@@ -264,14 +265,6 @@ GHashTable *_nm_ip_route_get_attributes_direct (NMIPRoute *route);
|
|||||||
NMSriovVF *_nm_utils_sriov_vf_from_strparts (const char *index, const char *detail, gboolean ignore_unknown, GError **error);
|
NMSriovVF *_nm_utils_sriov_vf_from_strparts (const char *index, const char *detail, gboolean ignore_unknown, GError **error);
|
||||||
gboolean _nm_sriov_vf_attribute_validate_all (const NMSriovVF *vf, GError **error);
|
gboolean _nm_sriov_vf_attribute_validate_all (const NMSriovVF *vf, GError **error);
|
||||||
|
|
||||||
static inline void
|
|
||||||
_nm_auto_ip_route_unref (NMIPRoute **v)
|
|
||||||
{
|
|
||||||
if (*v)
|
|
||||||
nm_ip_route_unref (*v);
|
|
||||||
}
|
|
||||||
#define nm_auto_ip_route_unref nm_auto (_nm_auto_ip_route_unref)
|
|
||||||
|
|
||||||
GPtrArray *_nm_utils_copy_array (const GPtrArray *array,
|
GPtrArray *_nm_utils_copy_array (const GPtrArray *array,
|
||||||
NMUtilsCopyFunc copy_func,
|
NMUtilsCopyFunc copy_func,
|
||||||
GDestroyNotify free_func);
|
GDestroyNotify free_func);
|
||||||
@@ -763,9 +756,6 @@ gboolean _nm_connection_find_secret (NMConnection *self,
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define nm_auto_unref_wgpeer nm_auto(_nm_auto_unref_wgpeer)
|
|
||||||
NM_AUTO_DEFINE_FCN0 (NMWireGuardPeer *, _nm_auto_unref_wgpeer, nm_wireguard_peer_unref)
|
|
||||||
|
|
||||||
gboolean nm_utils_base64secret_normalize (const char *base64_key,
|
gboolean nm_utils_base64secret_normalize (const char *base64_key,
|
||||||
gsize required_key_len,
|
gsize required_key_len,
|
||||||
char **out_base64_key_norm);
|
char **out_base64_key_norm);
|
||||||
|
@@ -20,7 +20,37 @@
|
|||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#include "nm-setting-connection.h"
|
||||||
|
#include "nm-setting-ip-config.h"
|
||||||
|
#include "nm-setting-sriov.h"
|
||||||
|
#include "nm-setting-team.h"
|
||||||
#include "nm-setting-vlan.h"
|
#include "nm-setting-vlan.h"
|
||||||
|
#include "nm-setting-wireguard.h"
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#define nm_auto_unref_ip_address nm_auto (_nm_ip_address_unref)
|
||||||
|
NM_AUTO_DEFINE_FCN0 (NMIPAddress *, _nm_ip_address_unref, nm_ip_address_unref)
|
||||||
|
|
||||||
|
#define nm_auto_unref_ip_route nm_auto (_nm_auto_unref_ip_route)
|
||||||
|
NM_AUTO_DEFINE_FCN0 (NMIPRoute *, _nm_auto_unref_ip_route, nm_ip_route_unref)
|
||||||
|
|
||||||
|
#define nm_auto_unref_sriov_vf nm_auto (_nm_auto_unref_sriov_vf)
|
||||||
|
NM_AUTO_DEFINE_FCN0 (NMSriovVF *, _nm_auto_unref_sriov_vf, nm_sriov_vf_unref)
|
||||||
|
|
||||||
|
#define nm_auto_unref_tc_qdisc nm_auto (_nm_auto_unref_tc_qdisc)
|
||||||
|
NM_AUTO_DEFINE_FCN0 (NMTCQdisc *, _nm_auto_unref_tc_qdisc, nm_tc_qdisc_unref)
|
||||||
|
|
||||||
|
#define nm_auto_unref_tc_tfilter nm_auto (_nm_auto_unref_tc_tfilter)
|
||||||
|
NM_AUTO_DEFINE_FCN0 (NMTCTfilter *, _nm_auto_unref_tc_tfilter, nm_tc_tfilter_unref)
|
||||||
|
|
||||||
|
#define nm_auto_unref_team_link_watcher nm_auto (_nm_auto_unref_team_link_watcher)
|
||||||
|
NM_AUTO_DEFINE_FCN0 (NMTeamLinkWatcher *, _nm_auto_unref_team_link_watcher, nm_team_link_watcher_unref)
|
||||||
|
|
||||||
|
#define nm_auto_unref_wgpeer nm_auto (_nm_auto_unref_wgpeer)
|
||||||
|
NM_AUTO_DEFINE_FCN0 (NMWireGuardPeer *, _nm_auto_unref_wgpeer, nm_wireguard_peer_unref)
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
static inline guint32
|
static inline guint32
|
||||||
nm_utils_vlan_priority_map_get_max_prio (NMVlanPriorityMap map, gboolean from)
|
nm_utils_vlan_priority_map_get_max_prio (NMVlanPriorityMap map, gboolean from)
|
||||||
|
@@ -820,7 +820,7 @@ parse_route_line (const char *line,
|
|||||||
NMIPRoute **out_route,
|
NMIPRoute **out_route,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
nm_auto_ip_route_unref NMIPRoute *route = NULL;
|
nm_auto_unref_ip_route NMIPRoute *route = NULL;
|
||||||
gs_free const char **words_free = NULL;
|
gs_free const char **words_free = NULL;
|
||||||
const char *const*words;
|
const char *const*words;
|
||||||
const char *s;
|
const char *s;
|
||||||
@@ -1284,7 +1284,7 @@ read_route_file (int addr_family,
|
|||||||
for (line = strtok_r (contents, "\n", &contents_rest);
|
for (line = strtok_r (contents, "\n", &contents_rest);
|
||||||
line;
|
line;
|
||||||
line = strtok_r (NULL, "\n", &contents_rest)) {
|
line = strtok_r (NULL, "\n", &contents_rest)) {
|
||||||
nm_auto_ip_route_unref NMIPRoute *route = NULL;
|
nm_auto_unref_ip_route NMIPRoute *route = NULL;
|
||||||
gs_free_error GError *local = NULL;
|
gs_free_error GError *local = NULL;
|
||||||
int e;
|
int e;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user