From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6410 invoked by alias); 1 Jul 2015 08:45:03 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35665 Received: (qmail 4126 invoked from network); 1 Jul 2015 08:45:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 X-Helo: d03dlp02.boulder.ibm.com X-MailFrom: hanpt@linux.vnet.ibm.com X-RcptTo: zsh-workers@zsh.org Date: Wed, 1 Jul 2015 16:34:40 +0800 From: Han Pingtian To: zsh-workers@zsh.org Subject: [PATCH] Improve error handling and fix a problem for parse_cmatcher() Message-ID: <20150701083440.GA13471@localhost.localdomain> Mail-Followup-To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15070108-0009-0000-0000-00000C24BF40 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