[Mono-devel-list] [PATCH] Additional System.Collections.Generic.{Dictionary, EqualityComparer} f

Raja R Harinath rharinath at novell.com
Sat Jun 18 23:16:58 EDT 2005


Hi,

>>> David Waite <dwaite at gmail.com> 06/19/05 12:13 AM >>>
> On 6/18/05, Raja R Harinath <rharinath at novell.com> wrote:
> > Hi,
> > 
> > > >>> David Waite <dwaite at gmail.com> 06/18/05 12:19 PM >>>
> > >     (Enumerator.MoveNext): Fix endless loop
> > 
> > ???  I couldn't find this fix.  The patch to this function was:
> 
> <snip>
> > +                               // if we are on an entry, try to
move to
> > the next linked entry
> > +                               // (in the bucket)
> >                                 if (_current != null)
> > +                               {
> >                                         _current = _current.Next;
> > -
> > +                               }
> 
> This statement wasn't present before. So the function didn't
> infinitely loop in the while, but attempting to use the Enumerator
> would cause an infinite loop, because

Sorry to harp on this point, but that statement was most definitely
present before.  It may have been deleted on your side while merging
due to a merge conflict.  (It's easier to see in your updated patch
that it was already there.)

BTW, I got the pre-condition and post-condition wrong, since I forgot
that IEnumerator.MoveNext() has further behaviours (that we do satisfy).
It probably should be:

  Pre-condition:
    _current == null => _nextIndex == 0 (first call to MoveNext())
			|| _nextIndex == _dictionaryTable.Length
			   (after the last useful call to MoveNext())

  Post-condition:
    _current == null => _nextIndex == _dictionaryTable.Length
			(last useful call to MoveNext())

With these changes, please go ahead and check your patch in.

Thanks,
- Hari




More information about the Mono-devel-list mailing list