Skip to content

Commit

Permalink
Make ComponentBox array getter follow naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
ximion committed Nov 8, 2023
1 parent e2d271b commit 3289341
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/as-component-box.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ as_component_box_new_simple (void)
*/

/**
* as_component_box_array:
* as_component_box_as_array:
* @cbox: An instance of #AsComponentBox.
*
* Get the contents of this component box as #GPtrArray.
*
* Returns: (transfer none) (element-type AsComponent): an array of #AsComponent instances.
*/
GPtrArray *
as_component_box_array (AsComponentBox *cbox)
as_component_box_as_array (AsComponentBox *cbox)
{
return cbox->cpts;
}
Expand Down
2 changes: 1 addition & 1 deletion src/as-component-box.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ AsComponentBox *as_component_box_new_simple (void);
AS_COMPONENT (g_ptr_array_index ((cbox)->cpts, (index_)))
#define as_component_box_len(cbox) (cbox)->cpts->len

GPtrArray *as_component_box_array (AsComponentBox *cbox);
GPtrArray *as_component_box_as_array (AsComponentBox *cbox);
AsComponentBoxFlags as_component_box_get_flags (AsComponentBox *cbox);

guint as_component_box_get_size (AsComponentBox *cbox);
Expand Down
17 changes: 9 additions & 8 deletions src/as-metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,19 +1407,20 @@ as_metadata_components_to_catalog (AsMetadata *metad, AsFormatKind format, GErro
return as_metadata_xml_serialize_to_catalog_with_rootnode (
metad,
context,
as_component_box_array (priv->cbox));
as_component_box_as_array (priv->cbox));
else
return as_metadata_xml_serialize_to_catalog_without_rootnode (
metad,
context,
as_component_box_array (priv->cbox));
as_component_box_as_array (priv->cbox));
} else if (format == AS_FORMAT_KIND_YAML) {
return as_metadata_yaml_serialize_to_catalog (metad,
context,
as_component_box_array (priv->cbox),
priv->write_header,
TRUE, /* add timestamp */
error);
return as_metadata_yaml_serialize_to_catalog (
metad,
context,
as_component_box_as_array (priv->cbox),
priv->write_header,
TRUE, /* add timestamp */
error);
} else {
g_set_error (error,
AS_METADATA_ERROR,
Expand Down
4 changes: 3 additions & 1 deletion src/as-pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,9 @@ gboolean
as_pool_add_components (AsPool *pool, AsComponentBox *cbox, GError **error)
{
AsPoolPrivate *priv = GET_PRIVATE (pool);
return as_cache_add_masking_components (priv->cache, as_component_box_array (cbox), error);
return as_cache_add_masking_components (priv->cache,
as_component_box_as_array (cbox),
error);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/test-performance.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ test_pool_cache_perf (void)
as_cache_set_locale (tmp_cache, "C");

as_cache_set_contents_for_path (tmp_cache,
as_component_box_array (prep_cpts),
as_component_box_as_array (prep_cpts),
"dummy",
NULL,
&error);
Expand All @@ -156,7 +156,7 @@ test_pool_cache_perf (void)
cache = as_cache_new ();
as_cache_set_locale (cache, "C");
as_cache_set_contents_for_path (cache,
as_component_box_array (prep_cpts),
as_component_box_as_array (prep_cpts),
"dummy",
NULL,
&error);
Expand Down
4 changes: 2 additions & 2 deletions tests/test-pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ test_cache (void)
cpts_post = as_cache_get_components_all (cache, &error);
g_assert_no_error (error);
g_assert_cmpint (as_component_box_len (cpts_post), ==, 20);
as_assert_component_lists_equal (as_component_box_array (cpts_post), cpts_pre);
as_assert_component_lists_equal (as_component_box_as_array (cpts_post), cpts_pre);

/* generate XML of the components retrieved from cache */
as_metadata_clear_components (mdata);
Expand Down Expand Up @@ -447,7 +447,7 @@ test_pool_read (void)

/* check categorization */
categories = as_get_default_categories (TRUE);
as_utils_sort_components_into_categories (as_component_box_array (all_cpts),
as_utils_sort_components_into_categories (as_component_box_as_array (all_cpts),
categories,
FALSE);
for (guint i = 0; i < categories->len; i++) {
Expand Down

0 comments on commit 3289341

Please sign in to comment.