On Tue, 11 Mar 2003, Andre Poenitz wrote:

> On Tue, Mar 11, 2003 at 11:50:19AM -0300, Joao Luis Meloni Assirati wrote:
> > I updated my patchs on inverse dvi search. Please have a look at it.
>
> +Buffer * BufferList::getBufferFromTmppath(string const & s)
> +{
> +       BufferStorage::iterator it = bstore.begin();
> +       BufferStorage::iterator end = bstore.end();
> +       for (; it != end; ++it) {
> +               if (prefixIs(s, (*it)->tmppath)) {
> +                       string::size_type tmppath_s =
> (*it)->tmppath.size();
> +                       if(s.size() == tmppath_s || s.at(tmppath_s) == '/')
> +                               return *it;
>
> Are you sure this works with directory separators other than '/'?

Good point. Probably not.

> Then you test whether  foo  is a prefix of  bar and have the same length.
> Testing for equality should be more straightforward, shouldn't it?

(prefixIs(s, (*it)->tmppath)) && s.at((*it)->tmppath.size())=='/')
|| (s == (*it)->tmppath)

Would be clearer, though more expensive (I think).

João.

Reply via email to