[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [wc-propcaching]: Cache existence of certain properties

From: Daniel Berlin <dberlin_at_dberlin.org>
Date: 2005-11-11 18:52:00 CET

On Fri, 2005-11-11 at 12:43 -0500, Michael Sinz wrote:
> On 11/11/05, Daniel Berlin <dberlin@dberlin.org> wrote:
> > On Fri, 2005-11-11 at 10:30 -0500, Michael Sinz wrote:
> > > On 11/11/05, Daniel Berlin <dberlin@dberlin.org> wrote:
> > > > On Fri, 2005-11-11 at 17:39 +0300, Ivan Zhakov wrote:
> > > [...]
> > > > > I see problem here. For example if in future we will have property
> > > > > "svn:needs-lock" and "svn:need". strstr() will find substring
> > > > > "svn:need" in case when property "svn:needs-lock" exists. I consider
> > > > > this is problem.
> > > >
> > > > Uh, why would we do such a thing?
> > > > Anyway, if you are really concerned, i'll make it split the string into
> > > > an array and search it, but it seems kinda a waste :)
> > >
> > > No, don't do that - just make sure that the string match includes
> > > a terminator (space, null, etc) (Easy in regexp)
> >
> > Well, then you have to guarantee that nothing strips whitespace from the
> > beginning and end of the string, or add terminators at the end of the
> > string besides null.
> > If we were going to do tha, then i'd rather just split it into an array.
>
> So, what spaces get stripped? The ones between the words? I hope not.
> The ones after the last word?
yes, possibly.

> Should not matter. For example, the
> search in perl for svn:need would be something like:
>
> if ($data =~ m/(^|\s+)svn:need(\s+|$)/)
> {
> ...
> }
>
> (untested, off-the-top-of-my-head) But this handles any whitespace,
> newline, eol, and end of string. (Yes, I know the C code does not
> have the regexp but it is relatively trivial to handle multiple delimiters.)

I understand what would be necessary to handle it in C.
without a regexp library, the easiest way to do it is to find a match,
and see if the next character is space or end of string, and if so move
on.
Why bother, when you could also just use a seperator that isn't going to
get stripped, like "," or "|"

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Nov 11 18:52:55 2005

This is an archived mail posted to the Subversion Dev mailing list.