summary refs log tree commit diff
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/nm-utils/nm-enum-utils.c9
-rw-r--r--shared/nm-utils/nm-macros-internal.h22
-rw-r--r--shared/nm-utils/nm-shared-utils.h5
-rw-r--r--shared/nm-utils/unaligned.h4
-rw-r--r--shared/nm-version-macros.h2
5 files changed, 23 insertions, 19 deletions
diff --git a/shared/nm-utils/nm-enum-utils.c b/shared/nm-utils/nm-enum-utils.c
index 023f8385..b83c4207 100644
--- a/shared/nm-utils/nm-enum-utils.c
+++ b/shared/nm-utils/nm-enum-utils.c
@@ -64,9 +64,18 @@ _ASSERT_enum_values_info (GType type,
 				 * And then, when actually running against a newer library version where
 				 * @type knows the nick, we have this situation.
 				 *
+				 * Another reason for specifying a nick both in @value_infos and @type,
+				 * is to specify an alias which is not used with highest preference. For
+				 * example, if you add an alias "disabled" for "none" (both numerically
+				 * equal), then the first alias in @value_infos will be preferred over
+				 * the name from @type. So, to still use "none" as preferred name, you may
+				 * explicitly specify the "none" alias in @value_infos before "disabled".
+				 *
 				 * However, what never is allowed, is to use a name (nick) to re-number
 				 * the value. That is, if both @value_infos and @type contain a particular
 				 * nick, their numeric values must agree as well.
+				 * Allowing this, would be very confusing, because the name would have a different
+				 * value from the regular GLib GEnum API.
 				 */
 				g_assert (enum_value->value == value_infos->value);
 			}
diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h
index 908b25fd..ef3039e6 100644
--- a/shared/nm-utils/nm-macros-internal.h
+++ b/shared/nm-utils/nm-macros-internal.h
@@ -807,8 +807,8 @@ nm_g_object_unref (gpointer obj)
 		g_object_unref (obj);
 }
 
-/* Assigns GObject @obj to destination @pdst, and takes an additional ref.
- * The previous value of @pdst is unrefed.
+/* Assigns GObject @obj to destination @pp, and takes an additional ref.
+ * The previous value of @pp is unrefed.
  *
  * It makes sure to first increase the ref-count of @obj, and handles %NULL
  * @obj correctly.
@@ -816,22 +816,18 @@ nm_g_object_unref (gpointer obj)
 #define nm_g_object_ref_set(pp, obj) \
 	({ \
 		typeof (*(pp)) *const _pp = (pp); \
-		typeof (**_pp) *const _obj = (obj); \
-		typeof (**_pp) *_p; \
+		typeof (*_pp) const _obj = (obj); \
+		typeof (*_pp) _p; \
 		gboolean _changed = FALSE; \
 		\
+		nm_assert (!_pp || !*_pp || G_IS_OBJECT (*_pp)); \
+		nm_assert (!_obj || G_IS_OBJECT (_obj)); \
+		\
 		if (   _pp \
 		    && ((_p = *_pp) != _obj)) { \
-			if (_obj) { \
-				nm_assert (G_IS_OBJECT (_obj)); \
-				 g_object_ref (_obj); \
-			} \
-			if (_p) { \
-				nm_assert (G_IS_OBJECT (_p)); \
-				*_pp = NULL; \
-				g_object_unref (_p); \
-			} \
+			nm_g_object_ref (_obj); \
 			*_pp = _obj; \
+			nm_g_object_unref (_p); \
 			_changed = TRUE; \
 		} \
 		_changed; \
diff --git a/shared/nm-utils/nm-shared-utils.h b/shared/nm-utils/nm-shared-utils.h
index 4b081630..58855237 100644
--- a/shared/nm-utils/nm-shared-utils.h
+++ b/shared/nm-utils/nm-shared-utils.h
@@ -520,8 +520,9 @@ void _nm_utils_strv_sort (const char **strv, gssize len);
 
 /*****************************************************************************/
 
-#define NM_UTILS_NS_PER_SECOND  ((gint64) 1000000000)
-#define NM_UTILS_NS_PER_MSEC    ((gint64) 1000000)
+#define NM_UTILS_NS_PER_SECOND   ((gint64) 1000000000)
+#define NM_UTILS_NS_PER_MSEC     ((gint64) 1000000)
+#define NM_UTILS_MSEC_PER_SECOND ((gint64) 1000)
 #define NM_UTILS_NS_TO_MSEC_CEIL(nsec)      (((nsec) + (NM_UTILS_NS_PER_MSEC - 1)) / NM_UTILS_NS_PER_MSEC)
 
 /*****************************************************************************/
diff --git a/shared/nm-utils/unaligned.h b/shared/nm-utils/unaligned.h
index feddaa91..965a5fe9 100644
--- a/shared/nm-utils/unaligned.h
+++ b/shared/nm-utils/unaligned.h
@@ -2,9 +2,7 @@
 #pragma once
 
 /***
-  This file is part of systemd.
-
-  Copyright 2014 Tom Gundersen
+  Copyright © 2014 Tom Gundersen
 ***/
 
 #include <endian.h>
diff --git a/shared/nm-version-macros.h b/shared/nm-version-macros.h
index 2a37c26d..7dcd068c 100644
--- a/shared/nm-version-macros.h
+++ b/shared/nm-version-macros.h
@@ -45,7 +45,7 @@
  * Evaluates to the micro version number of NetworkManager which this source
  * compiled against.
  */
-#define NM_MICRO_VERSION (4)
+#define NM_MICRO_VERSION (90)
 
 /**
  * NM_CHECK_VERSION: