1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-06-11 07:08:07 +02:00

51447: silence compiler maybe-uninitialized warning by combining a couple of variables

This commit is contained in:
Oliver Kiddle 2023-02-17 23:38:14 +01:00
parent 619cf4fbd5
commit 6f4aa1d949
2 changed files with 16 additions and 12 deletions

View file

@ -1,5 +1,8 @@
2023-02-17 Oliver Kiddle <opk@zsh.org> 2023-02-17 Oliver Kiddle <opk@zsh.org>
* 51447: Src/Zle/zle_keymap.c: silence compiler maybe-uninitialized
warning by combining a couple of variables
* Øystein Walle: 51391: Completion/Unix/Command/_git: * Øystein Walle: 51391: Completion/Unix/Command/_git:
complete remote branch names respecting --delete for git push complete remote branch names respecting --delete for git push

View file

@ -1586,7 +1586,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
Thingy func = t_undefinedkey; Thingy func = t_undefinedkey;
char *str = NULL; char *str = NULL;
int lastlen = 0, lastc = lastchar; int lastlen = 0, lastc = lastchar;
int timeout = 0, csi = 0, startcsi; int timeout = 0, csi = 0;
keybuflen = 0; keybuflen = 0;
keybuf[0] = 0; keybuf[0] = 0;
@ -1640,22 +1640,23 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
/* CSI key sequences have a well defined structure so if we currently /* CSI key sequences have a well defined structure so if we currently
* have an incomplete one, loop so the rest of it will be included in * have an incomplete one, loop so the rest of it will be included in
* the key sequence if that arrives within the timeout. */ * the key sequence if that arrives within the timeout. */
if (keybuflen >= 3 && !csi) { if (!csi && keybuflen >= 3 && keybuf[keybuflen - 3] == '\033' &&
startcsi = keybuflen - 3; keybuf[keybuflen - 2] == '[')
csi = keybuf[startcsi] == '\033' && keybuf[keybuflen - 2] == '['; csi = keybuflen - 1;
}
if (csi) { if (csi) {
csi = keybuf[keybuflen - 2] != Meta && keybuf[keybuflen - 1] >= 0x20 if (keybuf[keybuflen - 2] == Meta || keybuf[keybuflen - 1] < 0x20
&& keybuf[keybuflen - 1] <= 0x3f; || keybuf[keybuflen - 1] > 0x3f) {
/* If we reach the end of a valid CSI sequence and the matched key /* If we reach the end of a valid CSI sequence and the matched key
* binding is for part of the CSI introduction, select instead the * binding is for part of the CSI introduction, select instead the
* undefined-key widget and consume the full sequence from the * undefined-key widget and consume the full sequence from the
* input buffer. */ * input buffer. */
if (!csi && keybuf[keybuflen - 1] >= 0x40 && if (keybuf[keybuflen - 1] >= 0x40 &&
keybuf[keybuflen - 1] <= 0x7e && lastlen > startcsi && keybuf[keybuflen - 1] <= 0x7e && lastlen > csi - 2 &&
lastlen <= startcsi + 2) { lastlen <= csi) {
func = t_undefinedkey; func = t_undefinedkey;
lastlen = keybuflen; lastlen = keybuflen;
}
csi = 0;
} }
} }