[ostree] core: Make ot_transfer_out_value() take a & for the second argument
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Make ot_transfer_out_value() take a & for the second argument
- Date: Thu, 8 Dec 2011 22:33:08 +0000 (UTC)
commit d6ceb91c35154cf11f0448735646e2f3c62f068d
Author: Colin Walters <walters verbum org>
Date: Thu Dec 8 17:31:45 2011 -0500
core: Make ot_transfer_out_value() take a & for the second argument
As Ray Strode argued, it's confusing to have something that looks like
a function be magical. And OT_TRANSFER_OUT_VALUE is uglier.
src/libostree/ostree-core.c | 26 ++++++++++----------
src/libostree/ostree-repo-file.c | 6 ++--
src/libostree/ostree-repo.c | 50 +++++++++++++++++++-------------------
src/libotutil/ot-gio-utils.c | 2 +-
src/libotutil/ot-unix-utils.c | 4 +-
src/libotutil/ot-variant-utils.c | 2 +-
src/libotutil/otutil.h | 4 +-
7 files changed, 47 insertions(+), 47 deletions(-)
---
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index 42ba64b..78150b4 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -199,7 +199,7 @@ checksum_directory (GFileInfo *f_info,
g_variant_get_size (packed));
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
ot_clear_checksum (&ret_checksum);
ot_clear_gvariant (&dirmeta);
ot_clear_gvariant (&packed);
@@ -276,7 +276,7 @@ checksum_nondirectory (GFileInfo *file_info,
g_checksum_update (content_and_meta_sha256, (guint8*)g_variant_get_data (xattrs), g_variant_get_size (xattrs));
}
- ot_transfer_out_value(out_checksum, content_and_meta_sha256);
+ ot_transfer_out_value(out_checksum, &content_and_meta_sha256);
ret = TRUE;
out:
ot_clear_checksum (&content_sha256);
@@ -345,7 +345,7 @@ ostree_checksum_file (GFile *f,
goto out;
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
out:
g_clear_object (&file_info);
g_clear_object (&in);
@@ -515,7 +515,7 @@ ostree_parse_metadata_file (GFile *file,
ret = TRUE;
if (out_type)
*out_type = ret_type;
- ot_transfer_out_value(out_variant, ret_variant);
+ ot_transfer_out_value(out_variant, &ret_variant);
out:
ot_clear_gvariant (&ret_variant);
ot_clear_gvariant (&container);
@@ -677,7 +677,7 @@ ostree_pack_file_for_input (GOutputStream *output,
}
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
out:
if (pack_builder_initialized)
g_variant_builder_clear (&pack_builder);
@@ -806,9 +806,9 @@ ostree_parse_packed_file (GFile *file,
}
ret = TRUE;
- ot_transfer_out_value(out_file_info, ret_file_info);
- ot_transfer_out_value(out_xattrs, ret_xattrs);
- ot_transfer_out_value(out_content, in);
+ ot_transfer_out_value(out_file_info, &ret_file_info);
+ ot_transfer_out_value(out_xattrs, &ret_xattrs);
+ ot_transfer_out_value(out_content, &in);
out:
g_clear_object (&ret_file_info);
ot_clear_gvariant (&ret_xattrs);
@@ -961,7 +961,7 @@ ostree_create_file_from_input (GFile *dest_file,
}
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
out:
if (!ret)
(void) unlink (dest_path);
@@ -1075,8 +1075,8 @@ ostree_create_temp_file_from_input (GFile *dir,
}
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
- ot_transfer_out_value(out_file, possible_file);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
+ ot_transfer_out_value(out_file, &possible_file);
out:
if (rand)
g_rand_free (rand);
@@ -1111,8 +1111,8 @@ ostree_create_temp_regular_file (GFile *dir,
goto out;
ret = TRUE;
- ot_transfer_out_value(out_file, ret_file);
- ot_transfer_out_value(out_stream, ret_stream);
+ ot_transfer_out_value(out_file, &ret_file);
+ ot_transfer_out_value(out_stream, &ret_stream);
out:
g_clear_object (&ret_file);
g_clear_object (&ret_stream);
diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c
index 137469b..120c7dc 100644
--- a/src/libostree/ostree-repo-file.c
+++ b/src/libostree/ostree-repo-file.c
@@ -327,7 +327,7 @@ _ostree_repo_file_get_xattrs (OstreeRepoFile *self,
}
ret = TRUE;
- ot_transfer_out_value(out_xattrs, ret_xattrs);
+ ot_transfer_out_value(out_xattrs, &ret_xattrs);
out:
ot_clear_gvariant (&ret_xattrs);
g_clear_object (&local_file);
@@ -739,7 +739,7 @@ query_child_info_dir (OstreeRepo *repo,
}
ret = TRUE;
- ot_transfer_out_value(out_info, ret_info);
+ ot_transfer_out_value(out_info, &ret_info);
out:
g_clear_object (&ret_info);
ot_clear_gvariant (&metadata);
@@ -1087,7 +1087,7 @@ _ostree_repo_file_tree_query_child (OstreeRepoFile *self,
}
ret = TRUE;
- ot_transfer_out_value(out_info, ret_info);
+ ot_transfer_out_value(out_info, &ret_info);
out:
g_clear_object (&ret_info);
g_clear_object (&local_child);
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 43e436f..b998e5c 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -245,7 +245,7 @@ parse_rev_file (OstreeRepo *self,
goto out;
}
- ot_transfer_out_value(sha256, rev);
+ ot_transfer_out_value(sha256, &rev);
ret = TRUE;
out:
g_free (rev);
@@ -361,7 +361,7 @@ ostree_repo_resolve_rev (OstreeRepo *self,
}
}
- ot_transfer_out_value(sha256, ret_rev);
+ ot_transfer_out_value(sha256, &ret_rev);
ret = TRUE;
out:
ot_clear_gvariant (&commit);
@@ -540,7 +540,7 @@ keyfile_get_value_with_default (GKeyFile *keyfile,
}
ret = TRUE;
- ot_transfer_out_value(out_value, ret_value);
+ ot_transfer_out_value(out_value, &ret_value);
out:
g_free (ret_value);
return ret;
@@ -693,8 +693,8 @@ ostree_repo_stage_object (OstreeRepo *self,
g_clear_object (&temp_file);
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
- ot_transfer_out_value(out_tmpname, ret_tmpname);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
+ ot_transfer_out_value(out_tmpname, &ret_tmpname);
out:
if (temp_file)
(void) unlink (ot_gfile_get_path_cached (temp_file));
@@ -772,7 +772,7 @@ stage_and_commit_from_input (OstreeRepo *self,
g_clear_object (&tmp_file);
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
out:
if (tmp_file)
(void) unlink (ot_gfile_get_path_cached (tmp_file));
@@ -831,7 +831,7 @@ commit_file (OstreeRepo *self,
g_clear_object (&tmp_file);
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
out:
if (tmp_file)
(void) unlink (ot_gfile_get_path_cached (tmp_file));
@@ -868,7 +868,7 @@ import_gvariant_object (OstreeRepo *self,
goto out;
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
out:
g_clear_object (&mem);
ot_clear_checksum (&ret_checksum);
@@ -899,7 +899,7 @@ ostree_repo_load_variant_checked (OstreeRepo *self,
}
ret = TRUE;
- ot_transfer_out_value(out_variant, ret_variant);
+ ot_transfer_out_value(out_variant, &ret_variant);
out:
ot_clear_gvariant (&ret_variant);
return ret;
@@ -927,7 +927,7 @@ import_directory_meta (OstreeRepo *self,
goto out;
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
out:
ot_clear_checksum (&ret_checksum);
ot_clear_gvariant (&dirmeta);
@@ -1131,7 +1131,7 @@ import_commit (OstreeRepo *self,
goto out;
ret = TRUE;
- ot_transfer_out_value(out_commit, ret_commit);
+ ot_transfer_out_value(out_commit, &ret_commit);
out:
ot_clear_checksum (&ret_commit);
ot_clear_gvariant (&commit);
@@ -1329,8 +1329,8 @@ import_directory_recurse (OstreeRepo *self,
cancellable, error))
goto out;
- ot_transfer_out_value(out_metadata_checksum, ret_metadata_checksum);
- ot_transfer_out_value(out_contents_checksum, ret_contents_checksum);
+ ot_transfer_out_value(out_metadata_checksum, &ret_metadata_checksum);
+ ot_transfer_out_value(out_contents_checksum, &ret_contents_checksum);
ret = TRUE;
out:
g_clear_object (&dir_enum);
@@ -1392,7 +1392,7 @@ ostree_repo_commit_directory (OstreeRepo *self,
goto out;
ret = TRUE;
- ot_transfer_out_value(out_commit, ret_commit_checksum);
+ ot_transfer_out_value(out_commit, &ret_commit_checksum);
out:
ot_clear_checksum (&ret_commit_checksum);
g_free (current_head);
@@ -1468,7 +1468,7 @@ import_libarchive_entry_file (OstreeRepo *self,
goto out;
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
out:
g_clear_object (&archive_stream);
ot_clear_checksum (&ret_checksum);
@@ -1589,7 +1589,7 @@ file_tree_import_recurse (OstreeRepo *self,
ret_contents_checksum = g_strdup (g_checksum_get_string (ret_contents_checksum_obj));
ret = TRUE;
- ot_transfer_out_value(out_contents_checksum, ret_contents_checksum);
+ ot_transfer_out_value(out_contents_checksum, &ret_contents_checksum);
out:
if (dir_contents_checksums)
g_hash_table_destroy (dir_contents_checksums);
@@ -1811,8 +1811,8 @@ import_libarchive (OstreeRepo *self,
ret_metadata_checksum = g_strdup (root->metadata_checksum);
ret = TRUE;
- ot_transfer_out_value(out_contents_checksum, ret_contents_checksum);
- ot_transfer_out_value(out_metadata_checksum, ret_metadata_checksum);
+ ot_transfer_out_value(out_contents_checksum, &ret_contents_checksum);
+ ot_transfer_out_value(out_metadata_checksum, &ret_metadata_checksum);
out:
if (root)
file_tree_free (root);
@@ -2037,7 +2037,7 @@ ostree_repo_load_variant (OstreeRepo *self,
ret = TRUE;
if (out_type)
*out_type = ret_type;
- ot_transfer_out_value(out_variant, ret_variant);
+ ot_transfer_out_value(out_variant, &ret_variant);
out:
ot_clear_gvariant (&ret_variant);
g_clear_object (&f);
@@ -2246,7 +2246,7 @@ get_file_checksum (GFile *f,
}
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
out:
ot_clear_checksum (&tmp_checksum);
return ret;
@@ -2320,7 +2320,7 @@ diff_files (GFile *a,
}
ret = TRUE;
- ot_transfer_out_value(out_item, ret_item);
+ ot_transfer_out_value(out_item, &ret_item);
out:
if (ret_item)
ostree_repo_diff_item_unref (ret_item);
@@ -2554,7 +2554,7 @@ ostree_repo_read_commit (OstreeRepo *self,
goto out;
ret = TRUE;
- ot_transfer_out_value(out_root, ret_root);
+ ot_transfer_out_value(out_root, &ret_root);
out:
g_free (resolved_rev);
g_clear_object (&ret_root);
@@ -2584,9 +2584,9 @@ ostree_repo_diff (OstreeRepo *self,
goto out;
ret = TRUE;
- ot_transfer_out_value(out_modified, ret_modified);
- ot_transfer_out_value(out_removed, ret_removed);
- ot_transfer_out_value(out_added, ret_added);
+ ot_transfer_out_value(out_modified, &ret_modified);
+ ot_transfer_out_value(out_removed, &ret_removed);
+ ot_transfer_out_value(out_added, &ret_added);
out:
if (ret_modified)
g_ptr_array_free (ret_modified, TRUE);
diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c
index 1d94732..5f69360 100644
--- a/src/libotutil/ot-gio-utils.c
+++ b/src/libotutil/ot-gio-utils.c
@@ -188,7 +188,7 @@ ot_gio_splice_and_checksum (GOutputStream *out,
}
ret = TRUE;
- ot_transfer_out_value(out_checksum, ret_checksum);
+ ot_transfer_out_value(out_checksum, &ret_checksum);
out:
ot_clear_checksum (&ret_checksum);
return ret;
diff --git a/src/libotutil/ot-unix-utils.c b/src/libotutil/ot-unix-utils.c
index fb67148..e7357d7 100644
--- a/src/libotutil/ot-unix-utils.c
+++ b/src/libotutil/ot-unix-utils.c
@@ -67,7 +67,7 @@ ot_util_spawn_pager (GOutputStream **out_stream,
ret_stream = (GOutputStream*)g_unix_output_stream_new (stdin_fd, TRUE);
}
- ot_transfer_out_value(out_stream, ret_stream);
+ ot_transfer_out_value(out_stream, &ret_stream);
ret = TRUE;
out:
g_clear_object (&ret_stream);
@@ -149,7 +149,7 @@ ot_util_path_split_validate (const char *path,
}
ret = TRUE;
- ot_transfer_out_value(out_components, ret_components);
+ ot_transfer_out_value(out_components, &ret_components);
out:
if (ret_components)
g_ptr_array_unref (ret_components);
diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c
index cd9ba36..cb616f3 100644
--- a/src/libotutil/ot-variant-utils.c
+++ b/src/libotutil/ot-variant-utils.c
@@ -114,7 +114,7 @@ ot_util_variant_map (GFile *src,
g_variant_ref_sink (ret_variant);
ret = TRUE;
- ot_transfer_out_value(out_variant, ret_variant);
+ ot_transfer_out_value(out_variant, &ret_variant);
out:
ot_clear_gvariant (&ret_variant);
if (mfile)
diff --git a/src/libotutil/otutil.h b/src/libotutil/otutil.h
index 6e31f0e..019fff4 100644
--- a/src/libotutil/otutil.h
+++ b/src/libotutil/otutil.h
@@ -35,8 +35,8 @@
#define ot_transfer_out_value(outp, srcp) G_STMT_START { \
if (outp) \
{ \
- *outp = srcp; \
- srcp = NULL; \
+ *outp = *srcp; \
+ *(srcp) = NULL; \
} \
} G_STMT_END;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]