[Mono-dev] several patches for System.dll

Raja R Harinath rharinath at novell.com
Fri Sep 29 05:10:52 EDT 2006


Hi,

"Andrew Skiba" <andrews at mainsoft.com> writes:

> Please review these patches for System.dll.
>
> Part of them is needed to omit TARGET_JVM, so code will be common.
>
> * AcceptList.patch - stop using of non-standard methods from mscorlib
> * DigestClient.patch - use MD5.Create instead of HashAlgorithm.Create
> ("MD5")
> * IOrderedDictionary.patch - fix the base intefaces list to match .Net
> * ListDictionary.patch - remove unused output parameter (expensive in
> Java)
> * X509CertificateCollection.patch - remove unnecessary overload

The ListDictionary changes look good.  Please go ahead and commit [1].

- Hari

[1] Applies only to ListDictionary.patch of course.  I can't judge the
    rest of it

> Index: System.Collections.Specialized/ListDictionary.cs
> ===================================================================
> --- System.Collections.Specialized/ListDictionary.cs	(revision 66034)
> +++ System.Collections.Specialized/ListDictionary.cs	(working copy)
> @@ -49,6 +49,30 @@
>  			this.comparer = comparer;
>  		}
>  
> +		private DictionaryNode FindEntry (object key)
> +		{
> +			if (key == null)
> +				throw new ArgumentNullException ("key", "Attempted lookup for a null key.");
> +
> +			DictionaryNode entry = head;
> +			DictionaryNode prev = null;
> +			if (comparer == null) {
> +				while (entry != null) {
> +					if (key.Equals (entry.key))
> +						break;
> +					prev = entry;
> +					entry = entry.next;
> +				}
> +			} else {
> +				while (entry != null) {
> +					if (comparer.Compare (key, entry.key) == 0)
> +						break;
> +					prev = entry;
> +					entry = entry.next;
> +				}
> +			}
> +			return entry;
> +		}
>  		private DictionaryNode FindEntry (object key, out DictionaryNode prev)
>  		{
>  			if (key == null)
> @@ -137,8 +161,7 @@
>  		// Indexer
>  		public object this [object key] {
>  			get {
> -				DictionaryNode prev;
> -				DictionaryNode entry = FindEntry (key, out prev);
> +				DictionaryNode entry = FindEntry (key);
>  				return entry == null ? null : entry.value;
>  			}
>  
> @@ -179,8 +202,7 @@
>  
>  		public bool Contains (object key)
>  		{
> -			DictionaryNode prev;
> -			return FindEntry (key, out prev) != null;
> +			return FindEntry (key) != null;
>  		}
>  
>  		public IDictionaryEnumerator GetEnumerator ()
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list



More information about the Mono-devel-list mailing list