1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-27 02:53:27 +01:00

improve function

This commit is contained in:
Jfreegman 2014-06-04 14:41:36 -04:00
parent 97dedd32fb
commit 901ffbc7c0
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63

View File

@ -120,11 +120,16 @@ void rm_trailing_spaces_buf(wchar_t *buf, size_t *pos, size_t *len)
if (buf[*len - 1] != ' ') if (buf[*len - 1] != ' ')
return; return;
if (*pos == *len) int i;
--(*pos);
buf[--(*len)] = L'\0'; for (i = *len - 1; i >= 0; --i) {
rm_trailing_spaces_buf(buf, pos, len); if (buf[i] != ' ')
break;
}
*len = i + 1;
*pos = MIN(*pos, i + 1);
buf[*len] = L'\0';
} }
#define HIST_PURGE MAX_LINE_HIST / 4 #define HIST_PURGE MAX_LINE_HIST / 4