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

Ben Maurer bmaurer at ximian.com
Wed Feb 2 18:40:10 EST 2005


On Mon, 2005-01-31 at 19:21 +0100, Paolo Molaro wrote:
> 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.

This has been done (mostly by Zoltan).

> 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))) {
> 		...
> 	}
I've done this. In cases where the decl of iter was above the while
loop, I just did the assignment in the decl. Attached is the new
version.

-- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: metadata-class-members-cleanup.patch
Type: text/x-patch
Size: 30814 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050202/1d7936db/attachment.bin 


More information about the Mono-devel-list mailing list