Fix bug #311: On LinkedList.Clear, detach each node instead of dropping them en masse. #161

Merged
merged 1 commit into from Aug 18, 2011

Conversation

Projects
None yet
4 participants

No description provided.

Contributor

skolima commented Aug 17, 2011

This is consistent with LinkedList.Clear having O(n) complexity: http://msdn.microsoft.com/en-us/library/wdcbyw41%28v=vs.80%29.aspx . So +1 from me for this patch.

Any particular reason you used RemoveLast() instead of RemoveFirst()?

It seems that you should be using Remove() instead of either RemoveFirst() or RemoveLast(), since you've already checked that first != null.

Looks like the most performant solution would be:

while (first != null)
Remove (first.back);

I'm guessing you chose RemoveLast() due to RemoveFirst() incurring an extra assignment per loop than RemoveLast().

Correct: I used RemoveLast to possibly avoid an extra assignment.

I chose to use RemoveLast() instead of Remove(first.back) because it was there (DRY). Let it take care of any housekeeping or optimization, including any future code changes.

wwim pushed a commit to wwim/mono that referenced this pull request Aug 18, 2011

[runtime, globalization] Fix for Xamarin bug #161. Fix culture info d…
…ata for certain locale short date formats

Modified locales which don't use '/' as the short date separator.

alanmcgovern added a commit that referenced this pull request Aug 18, 2011

Merge pull request #161 from LogosBible/master
Fix bug #311: On LinkedList.Clear, detach each node instead of dropping them en masse.

@alanmcgovern alanmcgovern merged commit d23d8aa into mono:master Aug 18, 2011

alanmcgovern added a commit that referenced this pull request Aug 18, 2011

Merge pull request #161 from LogosBible/master
Fix bug #311: On LinkedList.Clear, detach each node instead of dropping them en masse.

duarten pushed a commit to duarten/mono that referenced this pull request Aug 21, 2011

[runtime, globalization] Fix for Xamarin bug #161. Fix culture info d…
…ata for certain locale short date formats

Modified locales which don't use '/' as the short date separator.

tjphilpot added a commit to LogosBible/mono that referenced this pull request Aug 23, 2011

Merge pull request #161 from LogosBible/master
Fix bug #311: On LinkedList.Clear, detach each node instead of dropping them en masse.
(cherry picked from commit f105c6d)

jbevain pushed a commit to jbevain/mono that referenced this pull request Nov 12, 2014

Merge pull request #161 from Unity-Technologies/ios/fix-cflags
[iOS] Fix AOT compiler CPP/CFLAGS. Case 641840
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment