zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] Improve error handling and fix a problem for parse_cmatcher()
@ 2015-07-01  8:34 Han Pingtian
  0 siblings, 0 replies; only message in thread
From: Han Pingtian @ 2015-07-01  8:34 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-01  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-01  8:34 [PATCH] Improve error handling and fix a problem for parse_cmatcher() Han Pingtian

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).