zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: [bug] type -m '^foo'
Date: Mon, 04 Oct 2004 11:32:05 +0100	[thread overview]
Message-ID: <200410041032.i94AW6pa011797@news01.csr.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0410011905370.25270@toltec.zanshin.com>

Bart Schaefer wrote:
> On Fri, 1 Oct 2004, Peter Stephenson wrote:
> 
> > > This fixes the crash, but it would be better if pattry() could be 
> > > rewritten so as not to need to modify the string in place.
> > 
> > I think this fixes it, but it's horribly complicated around there.
> 
> Hmm, well, what I meant was that it would be better if it could be re- 
> written so as not to need a null terminator at that point, i.e., to do 
> everything with array indices or starting/ending pointers rather than rely 
> on having a nul-terminated string.  Copying and freeing the string down in 
> the recursive guts of matching is probably more expensive (for certain 
> patterns, although far less expensive for other patterns) than copying the 
> whole string beforehand.
> 
> On the other hand the code is already doing zshcalloc() in that vicinity,
> so perhaps a few more allocs/frees is not enough to worry about.

Yes, I agree with all of that... however, rewriting the whole thing not
to require NULL-terminated strings is quite a big change (there's no
"memncmp" function, for example, and I'm not sure if you can guarantee
memcmp will stop comparing soon enough).  Only a few of the nasty
negative pattern matches need to rejig the string, so it would probably
make the vast majority of matches a bit slower.  I'll put it on the list
to look at.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


      reply	other threads:[~2004-10-04 10:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-01 14:50 Stephane Chazelas
2004-10-01 14:59 ` DervishD
2004-10-01 15:29 ` Danek Duvall
2004-10-01 15:32   ` Stephane Chazelas
2004-10-01 15:34     ` Danek Duvall
2004-10-01 16:56 ` Bart Schaefer
2004-10-01 18:22   ` Peter Stephenson
2004-10-02  2:17     ` Bart Schaefer
2004-10-04 10:32       ` Peter Stephenson [this message]

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=200410041032.i94AW6pa011797@news01.csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.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).