mirror of
https://github.com/vim/vim.git
synced 2025-09-28 04:24:06 -04:00
patch 7.4.783
Problem: copy_chars() and copy_spaces() are inefficient. Solution: Use memset() instead. (Dominique Pelle)
This commit is contained in:
34
src/misc2.c
34
src/misc2.c
@@ -1599,40 +1599,6 @@ strup_save(orig)
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* copy a space a number of times
|
||||
*/
|
||||
void
|
||||
copy_spaces(ptr, count)
|
||||
char_u *ptr;
|
||||
size_t count;
|
||||
{
|
||||
size_t i = count;
|
||||
char_u *p = ptr;
|
||||
|
||||
while (i--)
|
||||
*p++ = ' ';
|
||||
}
|
||||
|
||||
#if defined(FEAT_VISUALEXTRA) || defined(PROTO)
|
||||
/*
|
||||
* Copy a character a number of times.
|
||||
* Does not work for multi-byte characters!
|
||||
*/
|
||||
void
|
||||
copy_chars(ptr, count, c)
|
||||
char_u *ptr;
|
||||
size_t count;
|
||||
int c;
|
||||
{
|
||||
size_t i = count;
|
||||
char_u *p = ptr;
|
||||
|
||||
while (i--)
|
||||
*p++ = c;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* delete spaces at the end of a string
|
||||
*/
|
||||
|
Reference in New Issue
Block a user