bytes: avoid intermediate refs in g_bytes_new_from_bytes()
commit4151bce6db6e2a9090ce981a70d1af0bd1593a1d
authorChristian Hergert <chergert@redhat.com>
Mon, 22 Jan 2018 23:26:07 +0000 (22 15:26 -0800)
committerChristian Hergert <chergert@redhat.com>
Sat, 27 Jan 2018 19:43:38 +0000 (27 11:43 -0800)
tree00f7a43a7d47749287de8597ff88b27f5fdc0e6d
parent801accf74619c80849379b8fa7685100bc5b14d6
bytes: avoid intermediate refs in g_bytes_new_from_bytes()

When referencing a GBytes that is already a slice of another GBytes, we
can avoid referencing the intermediate GBytes and instead reference the
root bytes.

Doing so helps avoid keeping N GBytes instances alive when the
intermediates would have otherwise been finalized.

https://bugzilla.gnome.org/show_bug.cgi?id=792780
glib/gbytes.c