Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Sat, 18 Oct 2014 19:40:10 UTC Commit: 2c09333b6a3deb4f38a0b70888122829cc6e3818 https://github.com/geany/geany/commit/2c09333b6a3deb4f38a0b70888122829cc6e38...
Log Message: ----------- Remove unused tm_tags_custom_sort() and tm_tags_custom_dedup() and friends
Modified Paths: -------------- tagmanager/src/tm_tag.c tagmanager/src/tm_tag.h
Modified: tagmanager/src/tm_tag.c 49 lines changed, 2 insertions(+), 47 deletions(-) =================================================================== @@ -785,8 +785,8 @@ int tm_tag_compare(const void *ptr1, const void *ptr2) }
/* - Removes NULL tag entries from an array of tags. Called after tm_tags_dedup() and - tm_tags_custom_dedup() since these functions substitute duplicate entries with NULL + 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 */ @@ -830,29 +830,6 @@ gboolean tm_tags_dedup(GPtrArray *tags_array, TMTagAttrType *sort_attributes) }
/* - This is a more powerful form of tm_tags_dedup() since it can accomodate user - defined comparison functions. Called by tm_tags_custom_sort() is dedup is TRUE. - @param tags_array Array of tags to dedup. - @param compare_func Comparison function - @return TRUE on success, FALSE on FAILURE - @see TMTagCompareFunc -*/ -gboolean tm_tags_custom_dedup(GPtrArray *tags_array, TMTagCompareFunc compare_func) -{ - guint i; - - if ((!tags_array) || (!tags_array->len)) - return TRUE; - for (i = 1; i < tags_array->len; ++i) - { - if (0 == compare_func(&(tags_array->pdata[i - 1]), &(tags_array->pdata[i]))) - tags_array->pdata[i-1] = NULL; - } - tm_tags_prune(tags_array); - return TRUE; -} - -/* Sort an array of tags on the specified attribuites using the inbuilt comparison function. @param tags_array The array of tags to be sorted @@ -999,28 +976,6 @@ GPtrArray *tm_tags_merge(GPtrArray *big_array, GPtrArray *small_array, TMTagAttr }
/* - This function should be used whenever more involved sorting is required. For this, - you need to write a function as per the prototype of TMTagCompareFunc() and pass - the function as a parameter to this function. - @param tags_array Array of tags to be sorted - @param compare_func A function which takes two pointers to (TMTag *)s and returns - 0, 1 or -1 depending on whether the first value is equal to, greater than or less that - the second - @param dedup Whether to deduplicate the sorted array. Note that the same comparison - function will be used - @return TRUE on success, FALSE on failure -*/ -gboolean tm_tags_custom_sort(GPtrArray *tags_array, TMTagCompareFunc compare_func, gboolean dedup) -{ - if ((!tags_array) || (!tags_array->len)) - return TRUE; - qsort(tags_array->pdata, tags_array->len, sizeof(gpointer), compare_func); - if (dedup) - tm_tags_custom_dedup(tags_array, compare_func); - return TRUE; -} - -/* This function will extract the tags of the specified types from an array of tags. The returned value is a GPtrArray which should be free-d with a call to g_ptr_array_free(array, TRUE). However, do not free the tags themselves since they
Modified: tagmanager/src/tm_tag.h 18 lines changed, 3 insertions(+), 15 deletions(-) =================================================================== @@ -17,8 +17,8 @@ an array of tags for the given source file. Once the tag list is generated, you can do various operations such as: -# Extract relevant tags using tm_tags_extract() - -# Sort an array of tags using tm_tags_sort() or tm_tags_custom_sort() - -# Deduplicate an array of tags using tm_tags_dedup() or tm_tags_dedup_custom(). + -# Sort an array of tags using tm_tags_sort() + -# Deduplicate an array of tags using tm_tags_dedup().
An important thing to remember here is that the tags operations such as extraction, sorting and deduplication do not change the tag itself in any way, but rather, @@ -118,7 +118,7 @@ typedef enum pseudo tag. It should always be created indirectly with one of the tag creation functions such as tm_source_file_parse() or tm_tag_new_from_file(). Once created, they can be sorted, deduped, etc. using functions such as - tm_tags_custom_sort(), tm_tags_sort(), tm_tags_dedup() and tm_tags_custom_dedup() + tm_tags_sort() or tm_tags_dedup() */ typedef struct _TMTag { @@ -159,14 +159,6 @@ typedef enum { TM_FILE_FORMAT_CTAGS } TMFileFormat;
-/* - Prototype for user-defined tag comparison function. This is the type - of argument that needs to be passed to tm_tags_sort_custom() and - tm_tags_dedup_custom(). The function should take two void pointers, - cast them to (TMTag **) and return 0, 1 or -1 depending on whether the - first tag is equal to, greater than or less than the second tag. -*/ -typedef int (*TMTagCompareFunc) (const void *ptr1, const void *ptr2);
/* The GType for a TMTag */ #define TM_TYPE_TAG (tm_tag_get_type()) @@ -195,16 +187,12 @@ GPtrArray *tm_tags_merge(GPtrArray *big_array, GPtrArray *small_array, TMTagAttr
gboolean tm_tags_sort(GPtrArray *tags_array, TMTagAttrType *sort_attributes, gboolean dedup);
-gboolean tm_tags_custom_sort(GPtrArray *tags_array, TMTagCompareFunc compare_func, gboolean dedup); - GPtrArray *tm_tags_extract(GPtrArray *tags_array, guint tag_types);
gboolean tm_tags_prune(GPtrArray *tags_array);
gboolean tm_tags_dedup(GPtrArray *tags_array, TMTagAttrType *sort_attributes);
-gboolean tm_tags_custom_dedup(GPtrArray *tags_array, TMTagCompareFunc compare_func); - TMTag **tm_tags_find(const GPtrArray *tags_array, const char *name, gboolean partial, gboolean tags_array_sorted, int * tagCount);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).