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? 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.)
--
Michael Sinz Technology and Engineering Director/Consultant
"Starting Startups" mailto:Michael.Sinz@sinz.org
My place on the web http://www.sinz.org/Michael.Sinz
---------------------------------------------------------------------
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:43:47 2005