Created
April 26, 2016 19:13
-
-
Save irisfofs/52c76ec67ff0bc4d722c16d06c43443c to your computer and use it in GitHub Desktop.
Snippet from Weechat's gui-completion.c. I feel like this could be rewritten with memcpy...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (pos_start <= pos_end) | |
{ | |
completion->position_replace = pos_start; | |
completion->base_word = malloc (pos_end - pos_start + 2); | |
for (i = pos_start; i <= pos_end; i++) | |
{ | |
completion->base_word[i - pos_start] = data[i]; | |
} | |
completion->base_word[pos_end - pos_start + 1] = '\0'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment