@b4n commented on this pull request.
@@ -906,7 +906,12 @@ static gint sort_found_tags(gconstpointer a, gconstpointer b, gpointer user_data
* followed by workspace tags, * followed by global tags */ if (t1->type & tm_tag_local_var_t && t2->type & tm_tag_local_var_t) - return info->sort_by_name ? g_strcmp0(t1->name, t2->name) : t2->line - t1->line; + { + if (info->sort_by_name) + return g_strcmp0(t1->name, t2->name); + else /* just like (t2->line - t1->line), but doesn't overflow converting to int */ + return (t2->line > t1->line) ? 1 : (t2->line < t1->line) ? -1 : 0;
Fixed in a follow-up commit that will need to be squashed.
The other solution could be to be explicit: ```diff diff --git a/src/tagmanager/tm_workspace.c b/src/tagmanager/tm_workspace.c index 32fc36f05..6252ddd25 100644 --- a/src/tagmanager/tm_workspace.c +++ b/src/tagmanager/tm_workspace.c @@ -909,8 +909,13 @@ static gint sort_found_tags(gconstpointer a, gconstpointer b, gpointer user_data { if (info->sort_by_name) return g_strcmp0(t1->name, t2->name); - else /* just like (t2->line - t1->line), but doesn't overflow converting to int */ - return (t2->line > t1->line) ? 1 : (t2->line < t1->line) ? -1 : 0; + /* just like (t2->line - t1->line), but doesn't overflow converting to int */ + else if (t2->line > t1->line) + return 1; + else if (t2->line < t1->line) + return -1; + else + return 0; } else if (t1->type & tm_tag_local_var_t) return -1; ``` I'm not sure the verbosity is worth it though.