Use g_autoptr(GPtrArray) instead of gs_unref_ptrarray
This commit is contained in:
1 parent
196d983af9
commit
bb231fdf74
31 files changed
+60
-61
No files matched your search
@@ -138,7 +138,7 @@ _ostree_bootloader_grub2_generate_config (OstreeSysroot *sysroot
|
||||
gboolean ret = FALSE;
|
||||
GString *output = g_string_new ("");
|
||||
g_autoptr(GOutputStream) out_stream = NULL;
|
||||
gs_unref_ptrarray GPtrArray *loader_configs = NULL;
|
||||
g_autoptr(GPtrArray) loader_configs = NULL;
|
||||
guint i;
|
||||
gsize bytes_written;
|
||||
gboolean is_efi;
|
||||
@@ -304,7 +304,7 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader,
|
||||
if (ostree_sysroot_get_booted_deployment (self->sysroot) == NULL
|
||||
&& g_file_has_parent (self->sysroot->path, NULL))
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *deployments = NULL;
|
||||
g_autoptr(GPtrArray) deployments = NULL;
|
||||
OstreeDeployment *tool_deployment;
|
||||
g_autoptr(GFile) tool_deployment_root = NULL;
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ append_config_from_boostree_loader_entries (OstreeBootloaderSyslinux *self,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gs_unref_ptrarray GPtrArray *boostree_loader_configs = NULL;
|
||||
g_autoptr(GPtrArray) boostree_loader_configs = NULL;
|
||||
guint i;
|
||||
|
||||
if (!_ostree_sysroot_read_boot_loader_configs (self->sysroot, bootversion, &boostree_loader_configs,
|
||||
@@ -125,8 +125,8 @@ _ostree_bootloader_syslinux_write_config (OstreeBootloader *bootloader,
|
||||
g_autoptr(GFile) new_config_path = NULL;
|
||||
g_autofree char *config_contents = NULL;
|
||||
g_autofree char *new_config_contents = NULL;
|
||||
gs_unref_ptrarray GPtrArray *new_lines = NULL;
|
||||
gs_unref_ptrarray GPtrArray *tmp_lines = NULL;
|
||||
g_autoptr(GPtrArray) new_lines = NULL;
|
||||
g_autoptr(GPtrArray) tmp_lines = NULL;
|
||||
g_autofree char *kernel_arg = NULL;
|
||||
gboolean saw_default = FALSE;
|
||||
gboolean regenerate_default = FALSE;
|
||||
|
||||
@@ -70,7 +70,7 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gs_unref_ptrarray GPtrArray *boot_loader_configs = NULL;
|
||||
g_autoptr(GPtrArray) boot_loader_configs = NULL;
|
||||
OstreeBootconfigParser *config;
|
||||
const char *val;
|
||||
|
||||
@@ -111,7 +111,7 @@ _ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader,
|
||||
g_autoptr(GFile) new_config_path = NULL;
|
||||
g_autofree char *config_contents = NULL;
|
||||
g_autofree char *new_config_contents = NULL;
|
||||
gs_unref_ptrarray GPtrArray *new_lines = NULL;
|
||||
g_autoptr(GPtrArray) new_lines = NULL;
|
||||
|
||||
/* This should follow the symbolic link to the current bootversion. */
|
||||
config_contents = gs_file_load_contents_utf8 (self->config_path, cancellable, error);
|
||||
|
||||
@@ -428,7 +428,7 @@ ostree_raw_file_to_content_stream (GInputStream *input,
|
||||
gsize header_size;
|
||||
g_autoptr(GInputStream) ret_input = NULL;
|
||||
gs_unref_variant GVariant *file_header = NULL;
|
||||
gs_unref_ptrarray GPtrArray *streams = NULL;
|
||||
g_autoptr(GPtrArray) streams = NULL;
|
||||
g_autoptr(GOutputStream) header_out_stream = NULL;
|
||||
g_autoptr(GInputStream) header_in_stream = NULL;
|
||||
|
||||
|
||||
@@ -380,7 +380,7 @@ add_size_index_to_metadata (OstreeRepo *self,
|
||||
OstreeContentSizeCacheEntry *e_size = NULL;
|
||||
GVariantBuilder index_builder;
|
||||
guint i;
|
||||
gs_unref_ptrarray GPtrArray *sorted_keys = NULL;
|
||||
g_autoptr(GPtrArray) sorted_keys = NULL;
|
||||
|
||||
g_hash_table_iter_init (&entries, self->object_sizes);
|
||||
g_variant_builder_init (&index_builder,
|
||||
|
||||
@@ -123,8 +123,8 @@ write_libarchive_entry_to_mtree (OstreeRepo *self,
|
||||
const char *hardlink;
|
||||
const char *basename;
|
||||
g_autoptr(GFileInfo) file_info = NULL;
|
||||
gs_unref_ptrarray GPtrArray *split_path = NULL;
|
||||
gs_unref_ptrarray GPtrArray *hardlink_split_path = NULL;
|
||||
g_autoptr(GPtrArray) split_path = NULL;
|
||||
g_autoptr(GPtrArray) hardlink_split_path = NULL;
|
||||
glnx_unref_object OstreeMutableTree *subdir = NULL;
|
||||
glnx_unref_object OstreeMutableTree *parent = NULL;
|
||||
glnx_unref_object OstreeMutableTree *hardlink_source_parent = NULL;
|
||||
|
||||
@@ -220,7 +220,7 @@ ostree_repo_prune (OstreeRepo *self,
|
||||
goto out;
|
||||
}
|
||||
|
||||
{ gs_unref_ptrarray GPtrArray *deltas = NULL;
|
||||
{ g_autoptr(GPtrArray) deltas = NULL;
|
||||
guint i;
|
||||
|
||||
if (!ostree_repo_list_static_delta_names (self, &deltas,
|
||||
|
||||
@@ -153,7 +153,7 @@ build_content_sizenames_filtered (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gs_unref_ptrarray GPtrArray *ret_sizenames =
|
||||
g_autoptr(GPtrArray) ret_sizenames =
|
||||
g_ptr_array_new_with_free_func (_ostree_delta_content_sizenames_free);
|
||||
g_autoptr(GHashTable) sizenames_map =
|
||||
g_hash_table_new_full (g_str_hash, g_str_equal, NULL, _ostree_delta_content_sizenames_free);
|
||||
@@ -233,8 +233,8 @@ _ostree_delta_compute_similar_objects (OstreeRepo *repo,
|
||||
gboolean ret = FALSE;
|
||||
g_autoptr(GHashTable) ret_modified_regfile_content =
|
||||
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_ptr_array_unref);
|
||||
gs_unref_ptrarray GPtrArray *from_sizes = NULL;
|
||||
gs_unref_ptrarray GPtrArray *to_sizes = NULL;
|
||||
g_autoptr(GPtrArray) from_sizes = NULL;
|
||||
g_autoptr(GPtrArray) to_sizes = NULL;
|
||||
guint i, j;
|
||||
guint lower;
|
||||
guint upper;
|
||||
|
||||
@@ -1249,7 +1249,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
|
||||
guint64 total_compressed_size = 0;
|
||||
guint64 total_uncompressed_size = 0;
|
||||
gs_unref_variant_builder GVariantBuilder *part_headers = NULL;
|
||||
gs_unref_ptrarray GPtrArray *part_tempfiles = NULL;
|
||||
g_autoptr(GPtrArray) part_tempfiles = NULL;
|
||||
gs_unref_variant GVariant *delta_descriptor = NULL;
|
||||
gs_unref_variant GVariant *to_commit = NULL;
|
||||
g_autofree char *descriptor_relpath = NULL;
|
||||
|
||||
@@ -68,7 +68,7 @@ ostree_repo_list_static_delta_names (OstreeRepo *self,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gs_unref_ptrarray GPtrArray *ret_deltas = NULL;
|
||||
g_autoptr(GPtrArray) ret_deltas = NULL;
|
||||
g_autoptr(GFileEnumerator) dir_enum = NULL;
|
||||
|
||||
ret_deltas = g_ptr_array_new_with_free_func (g_free);
|
||||
|
||||
@@ -114,7 +114,7 @@ _ostree_compute_rollsum_matches (GBytes *from,
|
||||
OstreeRollsumMatches *ret_rollsum = NULL;
|
||||
g_autoptr(GHashTable) from_rollsum = NULL;
|
||||
g_autoptr(GHashTable) to_rollsum = NULL;
|
||||
gs_unref_ptrarray GPtrArray *matches = NULL;
|
||||
g_autoptr(GPtrArray) matches = NULL;
|
||||
const guint8 *from_buf;
|
||||
gsize from_len;
|
||||
const guint8 *to_buf;
|
||||
|
||||
@@ -99,7 +99,7 @@ list_all_deployment_directories (OstreeSysroot *self,
|
||||
gboolean ret = FALSE;
|
||||
g_autoptr(GFileEnumerator) dir_enum = NULL;
|
||||
g_autoptr(GFile) deploydir = NULL;
|
||||
gs_unref_ptrarray GPtrArray *ret_deployments = NULL;
|
||||
g_autoptr(GPtrArray) ret_deployments = NULL;
|
||||
GError *temp_error = NULL;
|
||||
|
||||
deploydir = g_file_resolve_relative_path (self->path, "ostree/deploy");
|
||||
@@ -186,7 +186,7 @@ list_all_boot_directories (OstreeSysroot *self,
|
||||
gboolean ret = FALSE;
|
||||
g_autoptr(GFileEnumerator) dir_enum = NULL;
|
||||
g_autoptr(GFile) boot_ostree = NULL;
|
||||
gs_unref_ptrarray GPtrArray *ret_bootdirs = NULL;
|
||||
g_autoptr(GPtrArray) ret_bootdirs = NULL;
|
||||
GError *temp_error = NULL;
|
||||
|
||||
boot_ostree = g_file_resolve_relative_path (self->path, "boot/ostree");
|
||||
@@ -296,8 +296,8 @@ cleanup_old_deployments (OstreeSysroot *self,
|
||||
guint i;
|
||||
g_autoptr(GHashTable) active_deployment_dirs = NULL;
|
||||
g_autoptr(GHashTable) active_boot_checksums = NULL;
|
||||
gs_unref_ptrarray GPtrArray *all_deployment_dirs = NULL;
|
||||
gs_unref_ptrarray GPtrArray *all_boot_dirs = NULL;
|
||||
g_autoptr(GPtrArray) all_deployment_dirs = NULL;
|
||||
g_autoptr(GPtrArray) all_boot_dirs = NULL;
|
||||
|
||||
if (stat ("/", &root_stbuf) != 0)
|
||||
{
|
||||
|
||||
@@ -369,9 +369,9 @@ merge_etc_changes (GFile *orig_etc,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gs_unref_ptrarray GPtrArray *modified = NULL;
|
||||
gs_unref_ptrarray GPtrArray *removed = NULL;
|
||||
gs_unref_ptrarray GPtrArray *added = NULL;
|
||||
g_autoptr(GPtrArray) modified = NULL;
|
||||
g_autoptr(GPtrArray) removed = NULL;
|
||||
g_autoptr(GPtrArray) added = NULL;
|
||||
guint i;
|
||||
int orig_etc_fd = -1;
|
||||
int modified_etc_fd = -1;
|
||||
@@ -620,7 +620,7 @@ selinux_relabel_dir (OstreeSysroot *sysroot,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gs_unref_ptrarray GPtrArray *path_parts = g_ptr_array_new ();
|
||||
g_autoptr(GPtrArray) path_parts = g_ptr_array_new ();
|
||||
g_autoptr(GFileInfo) root_info = NULL;
|
||||
|
||||
root_info = g_file_query_info (dir, OSTREE_GIO_FAST_QUERYINFO,
|
||||
@@ -651,7 +651,7 @@ selinux_relabel_file (OstreeSysroot *sysroot,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gs_unref_ptrarray GPtrArray *path_parts = g_ptr_array_new ();
|
||||
g_autoptr(GPtrArray) path_parts = g_ptr_array_new ();
|
||||
g_autoptr(GFileInfo) file_info = g_file_query_info (path, OSTREE_GIO_FAST_QUERYINFO,
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
cancellable, error);
|
||||
@@ -1710,7 +1710,7 @@ allocate_deployserial (OstreeSysroot *self,
|
||||
guint i;
|
||||
int new_deployserial = 0;
|
||||
g_autoptr(GFile) osdir = NULL;
|
||||
gs_unref_ptrarray GPtrArray *tmp_current_deployments =
|
||||
g_autoptr(GPtrArray) tmp_current_deployments =
|
||||
g_ptr_array_new_with_free_func (g_object_unref);
|
||||
|
||||
osdir = ot_gfile_get_child_build_path (self->path, "ostree/deploy", osname, NULL);
|
||||
@@ -1922,7 +1922,7 @@ ostree_sysroot_deployment_set_kargs (OstreeSysroot *self,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
guint i;
|
||||
gs_unref_ptrarray GPtrArray *new_deployments = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
g_autoptr(GPtrArray) new_deployments = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
glnx_unref_object OstreeDeployment *new_deployment = NULL;
|
||||
__attribute__((cleanup(_ostree_kernel_args_cleanup))) OstreeKernelArgs *kargs = NULL;
|
||||
g_autofree char *new_options = NULL;
|
||||
|
||||
@@ -372,7 +372,7 @@ _ostree_sysroot_read_boot_loader_configs (OstreeSysroot *self,
|
||||
gboolean ret = FALSE;
|
||||
int fd; /* Temporary owned by iterator */
|
||||
g_autofree char *entries_path = g_strdup_printf ("boot/loader.%d/entries", bootversion);
|
||||
gs_unref_ptrarray GPtrArray *ret_loader_configs = NULL;
|
||||
g_autoptr(GPtrArray) ret_loader_configs = NULL;
|
||||
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
|
||||
|
||||
if (!ensure_sysroot_fd (self, error))
|
||||
@@ -740,8 +740,8 @@ ostree_sysroot_load (OstreeSysroot *self,
|
||||
guint i;
|
||||
int bootversion = 0;
|
||||
int subbootversion = 0;
|
||||
gs_unref_ptrarray GPtrArray *boot_loader_configs = NULL;
|
||||
gs_unref_ptrarray GPtrArray *deployments = NULL;
|
||||
g_autoptr(GPtrArray) boot_loader_configs = NULL;
|
||||
g_autoptr(GPtrArray) deployments = NULL;
|
||||
|
||||
g_clear_pointer (&self->deployments, g_ptr_array_unref);
|
||||
g_clear_pointer (&self->booted_deployment, g_object_unref);
|
||||
@@ -1215,8 +1215,8 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot,
|
||||
gboolean ret = FALSE;
|
||||
guint i;
|
||||
OstreeDeployment *booted_deployment = NULL;
|
||||
gs_unref_ptrarray GPtrArray *deployments = NULL;
|
||||
gs_unref_ptrarray GPtrArray *new_deployments = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
g_autoptr(GPtrArray) deployments = NULL;
|
||||
g_autoptr(GPtrArray) new_deployments = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
gboolean retain = (flags & OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN) > 0;
|
||||
|
||||
deployments = ostree_sysroot_get_deployments (sysroot);
|
||||
|
||||
Reference in new issue
Block a user