mirror of
https://github.com/tmux/tmux.git
synced 2026-10-09 03:34:25 +00:00
Do not use subtraction for comparators, this doesn't really matter for
IDs but it breaks key sorting. GitHub issue 5646 from Alexandre Fiori.
(cherry picked from commit db3950ed07)
This commit is contained in:
14
hyperlinks.c
14
hyperlinks.c
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: hyperlinks.c,v 1.5 2026/06/29 16:44:06 nicm Exp $ */
|
||||
/* $OpenBSD: hyperlinks.c,v 1.6 2026/09/28 10:42:01 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021 Will <author@will.party>
|
||||
@@ -87,7 +87,11 @@ hyperlinks_by_uri_cmp(struct hyperlinks_uri *left, struct hyperlinks_uri *right)
|
||||
return (-1);
|
||||
if (*right->internal_id != '\0')
|
||||
return (1);
|
||||
return (left->inner - right->inner);
|
||||
if (left->inner < right->inner)
|
||||
return (-1);
|
||||
if (left->inner > right->inner)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
r = strcmp(left->internal_id, right->internal_id);
|
||||
@@ -104,7 +108,11 @@ static int
|
||||
hyperlinks_by_inner_cmp(struct hyperlinks_uri *left,
|
||||
struct hyperlinks_uri *right)
|
||||
{
|
||||
return (left->inner - right->inner);
|
||||
if (left->inner < right->inner)
|
||||
return (-1);
|
||||
if (left->inner > right->inner)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
RB_PROTOTYPE_STATIC(hyperlinks_by_inner_tree, hyperlinks_uri, by_inner_entry,
|
||||
hyperlinks_by_inner_cmp);
|
||||
|
||||
Reference in New Issue
Block a user