[Mono-devel-list] [PATCH] Cleanup of MonoClass member usage in metadata

Paolo Molaro lupus at ximian.com
Mon Jan 31 13:21:59 EST 2005

On 01/31/05 Ben Maurer wrote:
>       * The code is cleaner and easier to understand. This is especially
>         true in some areas where the old code would loop through all the
>         MonoMethod's or MonoField's looking for one with a specific
>         name. We now use the helper method in these cases. Even in areas
>         where the code can not be replaced with a more general function,
>         it is still quite a bit cleaner 

I think it's fine to commit the chunks that replace manual search
by name with the helper functions.
The other changes are not committable as is, because you use an ugly
coding pattern when you could use a nice one. You set the iter to NULL
far away from where it is used, with lots of unrelated stuff in
between. The correct way to use the iterators is with a for loop:

	for (iter = NULL; (m = mono_class_get_methods (klass, &iter)); ) {
or, when using while:
	iter = NULL;
	while ((m = mono_class_get_methods (klass, &iter))) {

> Index: debug-helpers.h
> ===================================================================
> --- debug-helpers.h	(revision 39775)
> +++ debug-helpers.h	(working copy)
> @@ -38,7 +38,5 @@
>  char*           mono_method_full_name (MonoMethod *method, gboolean signature);
> -MonoMethod *    mono_find_method_by_name (MonoClass *klass, const char *name, int param_count);

You can't remove functions from the public interface.

Once you make the changes, please post another patch. I'd wait to
commit it after the release, though, since it's large, it may
introduce bugs and it's not a bug fix.


lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better

More information about the Mono-devel-list mailing list