gmem: Only evaluate pointer argument to g_clear_pointer() once2e9c31af11b7d2d18052d5bbcdc3611f2f7480f5262/head
commit2e9c31af11b7d2d18052d5bbcdc3611f2f7480f5
authorPhilip Withnall <withnall@endlessm.com>
Wed, 22 Aug 2018 13:47:52 +0000 (22 14:47 +0100)
committerPhilip Withnall <withnall@endlessm.com>
Wed, 22 Aug 2018 13:47:52 +0000 (22 14:47 +0100)
tree341d290ca2b21832c42e852794af87d43976741d
parent9a72ebe01609f0e9afd299451ccbae8a677da9da
gmem: Only evaluate pointer argument to g_clear_pointer() once

The new typeof() macro version of g_clear_pointer() was evaluating its
pointer argument more than once, meaning any side effects would be
evaluated multiple times.

The existing (other) macro version of g_clear_pointer() was evaluating
its argument exactly once. This mismatch could have confused people or
lead to subtle bugs.

See https://gitlab.gnome.org/GNOME/glib/issues/1494.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
glib/gmem.h
glib/tests/utils.c