summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-buffer.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-04-29 21:20:08 +0200
committerSébastien Helleu <flashcode@flashtux.org>2015-04-29 21:20:08 +0200
commit499f36a7cf8d545693bcb5946408ff8a007ddac9 (patch)
treeddd558ae56919a627f5cfa5235a21bb5b7be12a1 /src/plugins/irc/irc-buffer.c
parent9793649e7904c83ecfa60135b46f5812a7074d43 (diff)
downloadweechat-499f36a7cf8d545693bcb5946408ff8a007ddac9.zip
irc: optimize search of a nick in nicklist (up to 3x faster)
Diffstat (limited to 'src/plugins/irc/irc-buffer.c')
-rw-r--r--src/plugins/irc/irc-buffer.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/plugins/irc/irc-buffer.c b/src/plugins/irc/irc-buffer.c
index c7daa2c23..41491f10e 100644
--- a/src/plugins/irc/irc-buffer.c
+++ b/src/plugins/irc/irc-buffer.c
@@ -180,12 +180,22 @@ irc_buffer_nickcmp_cb (void *data,
const char *nick1,
const char *nick2)
{
- IRC_BUFFER_GET_SERVER(buffer);
+ struct t_irc_server *server;
- /* make C compiler happy */
- (void) data;
+ if (data)
+ server = (struct t_irc_server *)data;
+ else
+ irc_buffer_get_server_and_channel (buffer, &server, NULL);
- return irc_server_strcasecmp (ptr_server, nick1, nick2);
+ if (server)
+ {
+ return irc_server_strcasecmp (server, nick1, nick2);
+ }
+ else
+ {
+ /* default is RFC 1459 casemapping comparison */
+ return weechat_strcasecmp_range (nick1, nick2, 29);
+ }
}
/*