PATCH 5/5: Move variable into scope where it's used

Mikael Magnusson <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <[email protected]>
This might have caused a valgrind warning when zlecs == zlell
and zleline[zlell] was uninitialized, but I didn't actually get any. It
still makes sense to move this variable into the else branch, though.
---
 Src/Zle/zle_misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 98a7fb0931..53345f2a29 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -853,11 +853,11 @@ whatcursorposition(UNUSED(char **args))
     char msg[100];
     char *s = msg, *mbstr;
     int bol = findbol(), len;
-    ZLE_CHAR_T c = zleline[zlecs];
 
     if (zlecs == zlell)
 	strucpy(&s, "EOF");
     else {
+	ZLE_CHAR_T c = zleline[zlecs];
 	strucpy(&s, "Char: ");
 	switch (c) {
 	case ZWC(' '):
-- 
2.38.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.