Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Improve error handling and fix a problem for parse_cmatcher()



The first two modifications are for improving error handling. The third is for
fixing the bug when 'both' is set to 1 previously.
---
 Src/Zle/complete.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index ea5e41f..850766c 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -268,7 +268,10 @@ parse_cmatcher(char *name, char *s)
 
 	    if (!*s || !*++s) {
 		if (name)
-		    zwarnnam(name, "missing line pattern");
+                   if (both)
+                       zwarnnam(name, "missing right anchor");
+                   else
+                       zwarnnam(name, "missing line pattern");
 		return pcm_err;
 	    }
 	} else
@@ -288,6 +291,7 @@ parse_cmatcher(char *name, char *s)
 	if ((fl & CMF_RIGHT) && !fl2 && (!*s || !*++s)) {
 	    if (name)
 		zwarnnam(name, "missing right anchor");
+           return pcm_err;
 	} else if (!(fl & CMF_RIGHT) || fl2) {
 	    if (!*s) {
 		if (name)
@@ -313,8 +317,7 @@ parse_cmatcher(char *name, char *s)
 		return pcm_err;
 	    }
 	    s++;
-	} else
-	    right = NULL;
+       }
 
 	if (*s == '*') {
 	    if (!(fl & (CMF_LEFT | CMF_RIGHT))) {
-- 
1.9.3



Messages sorted by: Reverse Date, Date, Thread, Author