tweaks: elide a tiny intermediate buffer, and rename two variables
Use the same method as in parse_verbatim_kbinput() for Unicode input.master
parent
45d2458b47
commit
e1199cd94d
19
src/winio.c
19
src/winio.c
|
@ -464,22 +464,19 @@ int parse_kbinput(WINDOW *win)
|
||||||
/* If the decimal byte value is complete, convert it and
|
/* If the decimal byte value is complete, convert it and
|
||||||
* put the obtained byte(s) back into the input buffer. */
|
* put the obtained byte(s) back into the input buffer. */
|
||||||
if (byte != ERR) {
|
if (byte != ERR) {
|
||||||
char *byte_mb;
|
char *multibyte;
|
||||||
int byte_mb_len, *seq, i;
|
int count, onebyte, i;
|
||||||
|
|
||||||
/* Convert the decimal code to one or two bytes. */
|
/* Convert the decimal code to one or two bytes. */
|
||||||
byte_mb = make_mbchar((long)byte, &byte_mb_len);
|
multibyte = make_mbchar((long)byte, &count);
|
||||||
|
|
||||||
seq = (int *)nmalloc(byte_mb_len * sizeof(int));
|
|
||||||
|
|
||||||
for (i = 0; i < byte_mb_len; i++)
|
|
||||||
seq[i] = (unsigned char)byte_mb[i];
|
|
||||||
|
|
||||||
/* Insert the byte(s) into the input buffer. */
|
/* Insert the byte(s) into the input buffer. */
|
||||||
unget_input(seq, byte_mb_len);
|
for (i = count; i > 0 ; i--) {
|
||||||
|
onebyte = (unsigned char)multibyte[i - 1];
|
||||||
|
unget_input(&onebyte, 1);
|
||||||
|
}
|
||||||
|
|
||||||
free(byte_mb);
|
free(multibyte);
|
||||||
free(seq);
|
|
||||||
|
|
||||||
byte_digits = 0;
|
byte_digits = 0;
|
||||||
escapes = 0;
|
escapes = 0;
|
||||||
|
|
Loading…
Reference in New Issue