Changeset b9d1fdc for irc.c


Ignore:
Timestamp:
2018-07-12T07:47:18Z (6 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
5c90890, 7de07a0
Parents:
ac8b4d9
git-author:
dequis <dx@…> (12-07-18 07:10:47)
git-committer:
dequis <dx@…> (12-07-18 07:47:18)
Message:

irc_vawrite: cut amount of strlen(irc->sendbuffer) calls in half

Building large send buffers are still slow and really could use some
GString, but this is an easy improvement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    rac8b4d9 rb9d1fdc  
    639639
    640640        if (irc->sendbuffer != NULL) {
    641                 size = strlen(irc->sendbuffer) + strlen(line);
     641                gsize line_len = strlen(line);
     642                gsize buffer_len = strlen(irc->sendbuffer);
     643
     644                size = buffer_len + line_len;
    642645                irc->sendbuffer = g_renew(char, irc->sendbuffer, size + 1);
    643                 strcpy((irc->sendbuffer + strlen(irc->sendbuffer)), line);
     646                strcpy((irc->sendbuffer + buffer_len), line);
    644647        } else {
    645648                irc->sendbuffer = g_strdup(line);
Note: See TracChangeset for help on using the changeset viewer.