NetworkManager/shared
Thomas Haller d060b7b379 shared: avoid invoking g_free() with NULL from gs_free cleanup attribute
In general, it's fine to pass %NULL to g_free().

However, consider:

    char *
    foo (void)
    {
        gs_free char *value = NULL;

        value = g_strdup ("hi");
        return g_steal_pointer (&value);
    }

gs_free, gs_local_free(), and g_steal_pointer() are all inlinable.
Here the compiler can easily recognize that we always pass %NULL to
g_free(). But with the previous implementation, the compiler would
not omit the call to g_free().

Similar patterns happen all over the place:

    gboolean
    baz (void)
    {
        gs_free char *value = NULL;

        if (!some_check ())
            return FALSE;

        value = get_value ();
        if (!value)
            return FALSE;

        return TRUE;
    }

in this example, g_free() is only required after setting @value to
non-NULL.

Note that this does increase the binary side a bit (4k for libnm, 8k
for NetworkManager, with "-O2").
2018-10-04 10:58:50 +02:00
..
c-list shared/c-list: re-import from latest c-util/c-list 2018-08-01 12:57:34 +02:00
c-rbtree Merge commit '4f4e96655625a0ad8c5fc451c5a3a8dda3bf5456' as 'shared/c-rbtree' 2018-09-18 15:08:46 +02:00
c-siphash Fix typos 2018-09-30 21:14:55 +02:00
n-acd Fix typos 2018-09-30 21:14:55 +02:00
nm-utils shared: avoid invoking g_free() with NULL from gs_free cleanup attribute 2018-10-04 10:58:50 +02:00
meson.build build: autodetect ebpf support 2018-09-19 17:23:11 +02:00
nm-common-macros.h manager: add connectivity-check-{available,enabled} properties. 2017-08-17 22:31:47 +02:00
nm-dbus-compat.h build: rename directory "include" to "shared" 2015-12-24 11:42:37 +01:00
nm-default.h Fix typos 2018-09-30 21:14:55 +02:00
nm-dispatcher-api.h build: cleanup src/Makefile.am 2016-08-11 11:54:18 +02:00
nm-ethtool-utils.c all/ethtool: add support for all currently supported kernel features 2018-08-10 10:38:19 +02:00
nm-ethtool-utils.h all/ethtool: add support for all currently supported kernel features 2018-08-10 10:38:19 +02:00
nm-meta-setting.c all: add 'match' setting 2018-08-11 09:41:07 +02:00
nm-meta-setting.h all: add 'match' setting 2018-08-11 09:41:07 +02:00
nm-test-libnm-utils.h tests: add nmtstc_auto_service_cleanup macro 2018-06-25 12:13:28 +02:00
nm-test-utils-impl.c all: don't use gchar/gshort/gint/glong but C types 2018-07-11 12:02:06 +02:00
nm-version-macros.h.in release: bump version to 1.15.0 (development) 2018-09-08 10:24:20 +02:00