mirror of
https://github.com/irssi/irssi.git
synced 2026-08-20 17:12:51 +02:00
Get rid of the non-portable memmem
The sequences we're after are found at the beginning or at the end of the buffer, there's no need to scan the whole thing.
This commit is contained in:
parent
4764b102ff
commit
6888fc5fc7
1 changed files with 5 additions and 9 deletions
|
|
@ -666,15 +666,11 @@ static void sig_input(void)
|
||||||
/* use the bracketed paste mode to detect when the user pastes
|
/* use the bracketed paste mode to detect when the user pastes
|
||||||
* some text into the entry */
|
* some text into the entry */
|
||||||
if (paste_use_bracketed_mode != FALSE && paste_buffer->len > 12) {
|
if (paste_use_bracketed_mode != FALSE && paste_buffer->len > 12) {
|
||||||
/* try to find the start/end sequence */
|
/* try to find the start/end sequence, we know that we
|
||||||
int seq_start = memmem(paste_buffer->data,
|
* either find those at the start/end of the buffer or
|
||||||
paste_buffer->len * g_array_get_element_size(paste_buffer),
|
* we don't find those at all. */
|
||||||
bp_start, sizeof(bp_start)) != NULL,
|
int seq_start = !memcmp(paste_buffer->data, bp_start, sizeof(bp_start)),
|
||||||
seq_end = memmem(paste_buffer->data,
|
seq_end = !memcmp(paste_buffer->data + paste_buffer->len * g_array_get_element_size(paste_buffer) - sizeof(bp_end), bp_end, sizeof(bp_end));
|
||||||
paste_buffer->len * g_array_get_element_size(paste_buffer),
|
|
||||||
bp_end, sizeof(bp_end)) != NULL;
|
|
||||||
|
|
||||||
g_warning("found sequences : start %d end %d", seq_start, seq_end);
|
|
||||||
|
|
||||||
if (seq_start) {
|
if (seq_start) {
|
||||||
paste_bracketed_mode = TRUE;
|
paste_bracketed_mode = TRUE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue