[Users] [Bug 1773] [PATCH] compare strings faster

noreply at thewildbeast.co.uk noreply at thewildbeast.co.uk
Thu Jul 13 00:46:42 CEST 2017


http://www.thewildbeast.co.uk/claws-mail/bugzilla/show_bug.cgi?id=1773

--- Comment #8 from Ricardo Mones <mones at users.sourceforge.net> ---
(In reply to comment #7)
> For a carefu(In reply to comment #6)
> > > We now depend on glib >= 2.20, so this problem is no longer a problem. :)
> > 
> > That strcmp2 sounds like a candidate for removal then :)
> 
> For a careful removal - the two functions return slightly different values
> for various combinations of null and non-null arguments, so a simple
> s/strcmp2/g_strcmp0/g might cause some breakage.

Indeed, just to be sure I've made a little test program which shows what you
say:

"(null)" "(null)"       g_strcmp0 = 0   strcmp2 = -1
"(null)" "abcdef"       g_strcmp0 = -1  strcmp2 = -1
"abcdef" "(null)"       g_strcmp0 = 1   strcmp2 = -1
"abcdef" "abcdef"       g_strcmp0 = 0   strcmp2 = 0
"abcdef" "fedcba"       g_strcmp0 = -5  strcmp2 = -5

Since usage is mostly to test != 0, the problematic case is the first one. Not
sure if some comparison relies on that inequality, I'll check tomorrow.

Otherwise the patch works fine so far :-)

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Users mailing list