mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
getchar: Eliminate two-iteration loop
This commit is contained in:
parent
37a77506b0
commit
9ec2bf26ce
@ -3794,8 +3794,7 @@ makemap (
|
|||||||
char *cmd;
|
char *cmd;
|
||||||
int abbr;
|
int abbr;
|
||||||
int hash;
|
int hash;
|
||||||
int did_cpo = FALSE;
|
bool did_cpo = false;
|
||||||
int i;
|
|
||||||
|
|
||||||
validate_maphash();
|
validate_maphash();
|
||||||
|
|
||||||
@ -3923,13 +3922,15 @@ makemap (
|
|||||||
/* When outputting <> form, need to make sure that 'cpo'
|
/* When outputting <> form, need to make sure that 'cpo'
|
||||||
* is set to the Vim default. */
|
* is set to the Vim default. */
|
||||||
if (!did_cpo) {
|
if (!did_cpo) {
|
||||||
if (*mp->m_str == NUL) /* will use <Nop> */
|
if (*mp->m_str == NUL) { // Will use <Nop>.
|
||||||
did_cpo = TRUE;
|
did_cpo = true;
|
||||||
else
|
} else {
|
||||||
for (i = 0; i < 2; ++i)
|
const char specials[] = { (char)(uint8_t)K_SPECIAL, NL, NUL };
|
||||||
for (p = (i ? mp->m_str : mp->m_keys); *p; ++p)
|
if (strpbrk((const char *)mp->m_str, specials) != NULL
|
||||||
if (*p == K_SPECIAL || *p == NL)
|
|| strpbrk((const char *)mp->m_keys, specials) != NULL) {
|
||||||
did_cpo = TRUE;
|
did_cpo = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (did_cpo) {
|
if (did_cpo) {
|
||||||
if (fprintf(fd, "let s:cpo_save=&cpo") < 0
|
if (fprintf(fd, "let s:cpo_save=&cpo") < 0
|
||||||
|| put_eol(fd) < 0
|
|| put_eol(fd) < 0
|
||||||
|
Loading…
Reference in New Issue
Block a user