[geany/geany] aea7d7: Remove some unused return values and unnecessary checks
Jiří Techet
git-noreply at xxxxx
Fri Jun 10 21:57:25 UTC 2016
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Mon, 21 Mar 2016 17:28:36 UTC
Commit: aea7d7845917843dd6b02e5a8dc9031cabc87a86
https://github.com/geany/geany/commit/aea7d7845917843dd6b02e5a8dc9031cabc87a86
Log Message:
-----------
Remove some unused return values and unnecessary checks
Modified Paths:
--------------
tagmanager/src/tm_tag.c
tagmanager/src/tm_tag.h
Modified: tagmanager/src/tm_tag.c
32 lines changed, 16 insertions(+), 16 deletions(-)
===================================================================
@@ -236,18 +236,19 @@ gboolean tm_tags_equal(const TMTag *a, const TMTag *b)
Removes NULL tag entries from an array of tags. Called after tm_tags_dedup() since
this function substitutes duplicate entries with NULL
@param tags_array Array of tags to dedup
- @return TRUE on success, FALSE on failure
*/
-gboolean tm_tags_prune(GPtrArray *tags_array)
+void tm_tags_prune(GPtrArray *tags_array)
{
guint i, count;
+
+ g_return_if_fail(tags_array);
+
for (i=0, count = 0; i < tags_array->len; ++i)
{
if (NULL != tags_array->pdata[i])
tags_array->pdata[count++] = tags_array->pdata[i];
}
tags_array->len = count;
- return TRUE;
}
/*
@@ -256,15 +257,16 @@ gboolean tm_tags_prune(GPtrArray *tags_array)
@param tags_array Array of tags to dedup.
@param sort_attributes Attributes the array is sorted on. They will be deduped
on the same criteria.
- @return TRUE on success, FALSE on failure
*/
-gboolean tm_tags_dedup(GPtrArray *tags_array, TMTagAttrType *sort_attributes, gboolean unref_duplicates)
+void tm_tags_dedup(GPtrArray *tags_array, TMTagAttrType *sort_attributes, gboolean unref_duplicates)
{
TMSortOptions sort_options;
guint i;
- if ((!tags_array) || (!tags_array->len))
- return TRUE;
+ g_return_if_fail(tags_array);
+ if (tags_array->len < 2)
+ return;
+
sort_options.sort_attrs = sort_attributes;
sort_options.partial = FALSE;
for (i = 1; i < tags_array->len; ++i)
@@ -277,7 +279,6 @@ gboolean tm_tags_dedup(GPtrArray *tags_array, TMTagAttrType *sort_attributes, gb
}
}
tm_tags_prune(tags_array);
- return TRUE;
}
/*
@@ -286,21 +287,19 @@ gboolean tm_tags_dedup(GPtrArray *tags_array, TMTagAttrType *sort_attributes, gb
@param tags_array The array of tags to be sorted
@param sort_attributes Attributes to be sorted on (int array terminated by 0)
@param dedup Whether to deduplicate the sorted array
- @return TRUE on success, FALSE on failure
*/
-gboolean tm_tags_sort(GPtrArray *tags_array, TMTagAttrType *sort_attributes,
+void tm_tags_sort(GPtrArray *tags_array, TMTagAttrType *sort_attributes,
gboolean dedup, gboolean unref_duplicates)
{
TMSortOptions sort_options;
-
- if ((!tags_array) || (!tags_array->len))
- return TRUE;
+
+ g_return_if_fail(tags_array);
+
sort_options.sort_attrs = sort_attributes;
sort_options.partial = FALSE;
g_ptr_array_sort_with_data(tags_array, tm_tag_compare, &sort_options);
if (dedup)
tm_tags_dedup(tags_array, sort_attributes, unref_duplicates);
- return TRUE;
}
void tm_tags_remove_file_tags(TMSourceFile *source_file, GPtrArray *tags_array)
@@ -501,8 +500,9 @@ GPtrArray *tm_tags_extract(GPtrArray *tags_array, TMTagType tag_types)
{
GPtrArray *new_tags;
guint i;
- if (NULL == tags_array)
- return NULL;
+
+ g_return_val_if_fail(tags_array, NULL);
+
new_tags = g_ptr_array_new();
for (i=0; i < tags_array->len; ++i)
{
Modified: tagmanager/src/tm_tag.h
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -145,14 +145,14 @@ void tm_tags_remove_file_tags(TMSourceFile *source_file, GPtrArray *tags_array);
GPtrArray *tm_tags_merge(GPtrArray *big_array, GPtrArray *small_array,
TMTagAttrType *sort_attributes, gboolean unref_duplicates);
-gboolean tm_tags_sort(GPtrArray *tags_array, TMTagAttrType *sort_attributes,
+void tm_tags_sort(GPtrArray *tags_array, TMTagAttrType *sort_attributes,
gboolean dedup, gboolean unref_duplicates);
GPtrArray *tm_tags_extract(GPtrArray *tags_array, guint tag_types);
-gboolean tm_tags_prune(GPtrArray *tags_array);
+void tm_tags_prune(GPtrArray *tags_array);
-gboolean tm_tags_dedup(GPtrArray *tags_array, TMTagAttrType *sort_attributes, gboolean unref_duplicates);
+void tm_tags_dedup(GPtrArray *tags_array, TMTagAttrType *sort_attributes, gboolean unref_duplicates);
TMTag **tm_tags_find(const GPtrArray *tags_array, const char *name,
gboolean partial, guint * tagCount);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list