[Mono-devel-list] [patch]Better error reporting when loading unmanaged libraries
Paolo Molaro
lupus at ximian.com
Mon May 17 14:28:27 EDT 2004
On 05/05/04 Denis Gervalle wrote:
> However, this may advocate for a conditional usage of this new feature,
Maybe enable it only when getenv("MONO_DEBUG") returns not NULL.
> diff -ru mono-0.91-orig/mono/metadata/icall.c mono-0.91/mono/metadata/icall.c
> --- mono-0.91-orig/mono/metadata/icall.c 2004-05-04 21:51:24.000000000 +0200
> +++ mono-0.91/mono/metadata/icall.c 2004-05-05 19:58:49.000000000 +0200
> @@ -4847,6 +4847,7 @@
> mono_exception_from_name_msg (mono_defaults.corlib, "System", exc_class, exc_arg ) );
> }
> /* create the wrapper, too? */
> + g_free((gpointer)exc_arg); /* No need to keep the error, no wrapper need it */
It would be better to change the function signature and document that
the string needs to be g_free()ed.
> diff -ru mono-0.91-orig/mono/metadata/loader.c mono-0.91/mono/metadata/loader.c
> --- mono-0.91-orig/mono/metadata/loader.c 2004-04-15 16:51:58.000000000 +0200
> +++ mono-0.91/mono/metadata/loader.c 2004-05-05 19:58:49.000000000 +0200
> @@ -564,6 +564,7 @@
> const char *orig_scope;
> const char *new_scope;
> char *full_name, *file_name;
> + gchar *error_array[7]={NULL,NULL,NULL,NULL,NULL,NULL,NULL};
You could use a GString here and just g_string_append () the error
messages: it makes the code cleaner and makes the memory management
simpler.
lupus
--
-----------------------------------------------------------------
lupus at debian.org debian/rules
lupus at ximian.com Monkeys do it better
More information about the Mono-devel-list
mailing list