[Mono-devel-list] Null Attributes arguments

Paolo Molaro lupus at ximian.com
Thu Dec 9 10:01:04 EST 2004


On 12/09/04 Marek Safar wrote:
> This patch implements NULL arguments support for attributes.
> OK to commit ?

Do you have a test case?

> Index: reflection.c
> ===================================================================
> --- reflection.c	(revision 37473)
> +++ reflection.c	(working copy)
> @@ -7041,7 +7041,13 @@
>  		break;
>  	}
>  	/* it may be a boxed value or a Type */
> -	case MONO_TYPE_OBJECT: {
> +	case MONO_TYPE_OBJECT: {
> +		if (arg == NULL) {
> +			*p++ = MONO_TYPE_STRING;
> +			*p++ = 0xFF;
> +			break;
> +		}
> +		
>  		MonoClass *klass = mono_object_class (arg);
>  		char *str;
>  		guint32 slen;

You can't add statements before local var declarations: it breaks
older compilers (of course you need to move the 
	klass = mono_object_class (arg);
assignment after the added NULL check).
Using MONO_TYPE_STRING is also very likely wrong at least
conceptually. Please post also a test case.

lupus

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



More information about the Mono-devel-list mailing list