lib: Change ot_util_variant_map helpers to consistently sink refs

This is similar to changes Krzesimir has been doing recently - we
really don't need the ergonomics of floating refs since we have
autocleanups.

We should continue to change most of our code to sink refs.

Specifically here it was pretty broken that the `_map()` API was
sinking but the other two weren't, and this broke some refactoring I
was trying to do later.

Closes: #317
Approved by: jlebon
This commit is contained in:
Colin Walters 2016-06-01 09:35:47 -04:00 committed by Atomic Bot
parent a189b19fd0
commit f725d39f11
2 changed files with 3 additions and 3 deletions

View File

@ -512,6 +512,7 @@ _ostree_static_delta_part_open (GInputStream *part_in,
g_bytes_get_size (inline_part_bytes) - 1);
ret_part = g_variant_new_from_bytes (G_VARIANT_TYPE (OSTREE_STATIC_DELTA_PART_PAYLOAD_FORMAT_V0),
content_bytes, trusted);
g_variant_ref_sink (ret_part);
}
if (!skip_checksum)

View File

@ -166,7 +166,6 @@ ot_util_variant_map_at (int dfd,
GError **error)
{
glnx_fd_close int fd = -1;
g_autoptr(GVariant) ret_variant = NULL;
fd = openat (dfd, path, O_RDONLY | O_CLOEXEC);
if (fd < 0)
@ -224,8 +223,8 @@ ot_util_variant_map_fd (int fd,
mdata->len = len;
ret = TRUE;
*out_variant = g_variant_new_from_data (type, map, len, trusted,
variant_map_data_destroy, mdata);
*out_variant = g_variant_ref_sink (g_variant_new_from_data (type, map, len, trusted,
variant_map_data_destroy, mdata));
out:
return ret;
}