tree-wide: Convert to using autoptr(GString) vs g_string_free(...,TRUE)

If we're freeing the segment, it's basically always better to use
`autoptr()`.  Fewer lines, more reliable, etc.

Noticed an instance of this in the pull code while reviewing a different PR,
decided to do a grep for it and fix it tree wide.

Closes: #836
Approved by: pwithnall
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-05-05 15:10:51 +00:00
1 parent bf9772f231
commit 712bf21914
13 files changed
+21 -63

No files matched your search

+1 -2
View File
@@ -433,7 +433,7 @@ add_size_index_to_metadata (OstreeRepo *self,
{
guint8 csum[OSTREE_SHA256_DIGEST_LEN];
const char *e_checksum = sorted_keys->pdata[i];
GString *buffer = g_string_new (NULL);
g_autoptr(GString) buffer = g_string_new (NULL);
ostree_checksum_inplace_to_bytes (e_checksum, csum);
g_string_append_len (buffer, (char*)csum, sizeof (csum));
@@ -444,7 +444,6 @@ add_size_index_to_metadata (OstreeRepo *self,
g_variant_builder_add (&index_builder, "@ay",
ot_gvariant_new_bytearray ((guint8*)buffer->str, buffer->len));
g_string_free (buffer, TRUE);
}
g_variant_builder_add (builder, "{sv}", "ostree.sizes",