commit bd2f3f1: [Minor] Fix url_cmp operation

Vsevolod Stakhov vsevolod at rspamd.com
Thu Oct 20 20:49:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-10-20 21:47:01 +0100
URL: https://github.com/rspamd/rspamd/commit/bd2f3f1c94449e4db55ddcfdd3c492d3edd60c19 (HEAD -> master)

[Minor] Fix url_cmp operation

---
 src/libserver/url.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libserver/url.c b/src/libserver/url.c
index 62f21e367..7892149af 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -4281,7 +4281,7 @@ rspamd_url_cmp (const struct rspamd_url *u1, const struct rspamd_url *u2)
 	int r;
 
 	if (u1->protocol != u2->protocol) {
-		return u1->protocol < u2->protocol;
+		return u1->protocol - u2->protocol;
 	}
 
 	if (u1->protocol & PROTOCOL_MAILTO) {
@@ -4301,7 +4301,7 @@ rspamd_url_cmp (const struct rspamd_url *u1, const struct rspamd_url *u2)
 				}
 			}
 			else {
-				r = u1->hostlen < u2->hostlen;
+				r = u1->hostlen - u2->hostlen;
 			}
 		}
 	}
@@ -4311,7 +4311,7 @@ rspamd_url_cmp (const struct rspamd_url *u1, const struct rspamd_url *u2)
 			r = memcmp (u1->string, u2->string, min_len);
 
 			if (r == 0) {
-				r = u1->urllen < u2->urllen;
+				r = u1->urllen - u2->urllen;
 			}
 		}
 		else {


More information about the Commits mailing list