[Mono-dev] [PATCH] Extract mono_exception_get_message_string from mono_print_exception
Rodrigo Kumpera
kumpera at gmail.com
Fri Jul 2 17:18:34 EDT 2010
/*
* g_printerr ("\nUnhandled Exception: %s.%s: %s\n",
exc->vtable->klass->name_space,
* exc->vtable->klass->name, message);
*/
+
g_printerr ("\nUnhandled Exception: %s\n", message);
-
+
if (free_message)
Please remove the whitespace noise.
mono_string_to_utf8_checked can't be added to the public API without proper
documentation.
Patch looks good besides this.
On Fri, Jul 2, 2010 at 5:34 PM, Michael Hutchinson <m.j.hutchinson at gmail.com
> wrote:
> On Fri, Jul 2, 2010 at 3:43 PM, Robert Jordan <robertj at gmx.net> wrote:
> >
> > You can get rid of the loop and optimize it further by caching
> > System.Object's ToString method:
> >
> > MonoString *
> > mono_object_to_string (MonoObject *obj, MonoObject **exc)
> > {
> > static MonoMethod *to_string = NULL;
> > MonoMethod *method;
> >
> > g_assert (obj);
> >
> > if (!to_string)
> > to_string = mono_class_get_method_from_name_flags
> > (mono_get_object_class (), "ToString", 0, METHOD_ATTRIBUTE_VIRTUAL |
> > METHOD_ATTRIBUTE_PUBLIC);
> >
> > method = mono_object_get_virtual_method (obj, method);
> >
> > return (MonoString *) mono_runtime_invoke (method, obj, NULL,
> exc);
> > }
>
> Makes sense - I'm not familiar with Mono runtime API, and I'd just
> lifted code directly from mono_print_exception.
>
> I've folded this into my patch (with the to_string fix), added
> Changelogs, and updated the utils Makefile.am to install mono-error.h.
>
> OK to commit now?
>
> --
> Michael Hutchinson
> http://mjhutchinson.com
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100702/982ecd15/attachment.html
More information about the Mono-devel-list
mailing list