NetworkManager/shared/nm-utils
Thomas Haller fda3458201 shared: rework _NM_GET_PRIVATE() to use _Generic()
_NM_GET_PRIVATE() used typeof() to propagate constness of the @self
pointer. However, that means, it could only be used with a self pointer
of the exact type. That means, you explicitly had to cast from (GObject *)
or from (void *).
The requirement is cumbersome, and often led us to either create @self
pointer we didn't need:

    NMDeviceVlan *self = NM_DEVICE_VLAN (device);
    NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (self);

or casting:

    NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE ((NMDevice *) device);

In both cases we forcefully cast the source variable, loosing help from
the compiler to detect a bug.

For "nm-linux-platform.c", instead we commonly have a pointer of type
NMPlatform. Hence, we always forcefully cast the type via _NM_GET_PRIVATE_VOID().

Rework the macro to use _Generic(). If compiler supports _Generic(), then we
will get all compile time checks as desired. If the compiler doesn't support
_Generic(), it will still work. You don't get the compile-time checking of course,
but you'd notice that something is wrong once you build with a suitable
compiler.

(cherry picked from commit b1810d7a68)
2017-11-13 14:37:21 +01:00
..
c-list-util.c c-list: add c_list_sort() 2017-07-25 06:42:14 +02:00
c-list-util.h c-list: add c_list_sort() 2017-07-25 06:42:14 +02:00
c-list.h shared: update c-list 2017-07-05 14:22:10 +02:00
gsystem-local-alloc.h shared: move shared files to subdirectory "shared/nm-utils/" 2016-06-16 10:45:53 +02:00
nm-dedup-multi.c all: extend hash functions with an NMHashState argument 2017-10-18 13:29:22 +02:00
nm-dedup-multi.h all: extend hash functions with an NMHashState argument 2017-10-18 13:29:22 +02:00
nm-enum-utils.c shared: cast from/to argument to unsigned for GFlags in _nm_utils_enum_get_values() 2017-04-27 18:01:58 +02:00
nm-enum-utils.h libnm: move public nm_utils_enum_*() functions back to libnm-core 2017-04-05 18:38:31 +02:00
nm-glib.h shared: add nm-glib.h compat implementation for g_variant_new_printf() 2017-09-18 20:14:09 +02:00
nm-hash-utils.c shared: fix compilation on 32-bit archictectures 2017-10-26 15:13:40 +02:00
nm-hash-utils.h all: add helper functions for nm_hash_update*() 2017-10-18 13:29:22 +02:00
nm-macros-internal.h shared: rework _NM_GET_PRIVATE() to use _Generic() 2017-11-13 14:37:21 +01:00
nm-obj.h all: add base object type in "nm-obj.h" 2017-07-05 14:22:10 +02:00
nm-random-utils.c shared: split random and hash utils 2017-10-17 20:02:59 +02:00
nm-random-utils.h shared: split random and hash utils 2017-10-17 20:02:59 +02:00
nm-shared-utils.c shared: split random and hash utils 2017-10-17 20:02:59 +02:00
nm-shared-utils.h shared: split random and hash utils 2017-10-17 20:02:59 +02:00
nm-test-utils.h tests: add nmtst_assert_connection_has_settings() helper 2017-10-30 21:46:55 +01:00
nm-udev-utils.c libnm: don't cunescape \x00 encoding in nm_udev_utils_property_decode() 2017-05-19 09:46:08 +02:00
nm-udev-utils.h udev: add and use nm_udev_utils_property_decode() function 2017-03-22 12:41:06 +01:00
nm-vpn-editor-plugin-call.h shared: include "gsystem-local-alloc.h" from "nm-glib.h" 2016-06-16 10:45:54 +02:00
nm-vpn-plugin-macros.h shared: add nm_utils_syslog_coerce_from_nm() util 2016-09-19 15:35:33 +02:00
nm-vpn-plugin-utils.c shared: add "nm-utils/nm-vpn-plugin-utils.h" 2016-06-16 10:45:54 +02:00
nm-vpn-plugin-utils.h shared: add "nm-utils/nm-vpn-plugin-utils.h" 2016-06-16 10:45:54 +02:00
siphash24.c all: use siphash24 for hashing 2017-10-18 13:27:02 +02:00
siphash24.h all: use siphash24 for hashing 2017-10-18 13:27:02 +02:00
unaligned.h shared: add unaligned.h 2016-10-14 11:16:13 +02:00