zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: Small memory leak and doc fix
Date: Thu, 8 Jun 2000 11:20:38 +0200 (MET DST)	[thread overview]
Message-ID: <200006080920.LAA20257@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Felix Rosencrantz's message of Wed, 7 Jun 2000 19:50:52 -0700 (PDT)


Felix Rosencrantz wrote:

> >The patch below seems to make sense, but I'm not sure if that was the
> >problem. Felix, could you try, please?
> 
> Sven, I built a cvs pull with your changes, and noticed that compmatch test
> failure that Vin is also seeing.

Yes, a thinko in the patch. Sorry.

> I used the shell during the day, and didn't see the memory problem I reported.
> However, some of completions I tried that I think will cause the problem also
> are failing.  So, the patch took care of the memory problem, but probably
> caused this new matching problem.

Ok. Could you try again with this patch? It should make things even
safer.

And I forgot to say: this might also have to do with the build.out
test failure some people saw (11653) and which couldn't
reproduce. Could someone who can reproduce that reliably (Andrej?
Felix?) try it again?


Bye
 Sven

Index: Src/Zle/compmatch.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v
retrieving revision 1.17
diff -u -r1.17 compmatch.c
--- Src/Zle/compmatch.c	2000/06/07 13:25:32	1.17
+++ Src/Zle/compmatch.c	2000/06/08 09:18:18
@@ -535,8 +535,7 @@
 		    }
 		    /* Give up if we don't have enough characters for the
 		     * line-string and the anchor. */
-		    if (ll < llen + alen ||
-			(sfx ? (lw < alen + aol) : (lw < alen || iw < aol)))
+		    if (ll < llen + alen || lw < alen)
 			continue;
 
 		    if (mp->flags & CMF_LEFT) {
@@ -561,8 +560,9 @@
 			if (!pattern_match(ap, l + aoff, NULL, NULL) ||
 			    (both &&
 			     (!pattern_match(ap, w + aoff, NULL, NULL) ||
-			      (aol && !pattern_match(aop, w + aoff - aol,
-						     NULL, NULL)) ||
+			      (aol && aol <= aoff + iw &&
+			       !pattern_match(aop, w + aoff - aol,
+					      NULL, NULL)) ||
 			      !match_parts(l + aoff, w + aoff, alen, part))))
 				continue;
 		    } else if (!both || il || iw)
@@ -572,19 +572,20 @@
 		     * string matched by the `*'. */
 		    if (sfx && (savl = l[-(llen + zoff)]))
 			l[-(llen + zoff)] = '\0';
-		    for (t = 0, tp = w, ct = 0,
-			     ict = lw - alen + 1 - (sfx ? aol : 0);
+		    for (t = 0, tp = w, ct = 0, ict = lw - alen + 1;
 			 ict;
 			 tp += add, ct++, ict--) {
 			if ((both &&
 			     (!ap || !test ||
 			      !pattern_match(ap, tp + aoff, NULL, NULL) ||
-			      (aol && !pattern_match(aop, tp + aoff - aol,
-						     NULL, NULL)))) ||
+			      (aol && aol <= aoff + ct + iw &&
+			       !pattern_match(aop, tp + aoff - aol,
+					      NULL, NULL)))) ||
 			    (!both &&
 			     pattern_match(ap, tp - moff, NULL, NULL) &&
-			     (!aol || pattern_match(aop, tp - moff - aol,
-						    NULL, NULL)) &&
+			     (!aol || (aol <= iw + ct - moff &&
+				       pattern_match(aop, tp - moff - aol,
+						     NULL, NULL))) &&
 			     (mp->wlen == -1 ||
 			      match_parts(l + aoff , tp - moff,
 						      alen, part)))) {

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-06-08  9:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-08  9:20 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-06-09  5:26 Felix Rosencrantz
2000-06-08  2:50 Felix Rosencrantz
2000-06-07 13:23 Sven Wischnowsky
2000-06-06  5:31 Felix Rosencrantz
2000-06-05  7:55 Sven Wischnowsky
2000-06-03  3:23 Felix Rosencrantz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200006080920.LAA20257@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).