case nsIDataType::VTYPE_VOID: case nsIDataType::VTYPE_ASTRING: case nsIDataType::VTYPE_WSTRING_SIZE_IS: case nsIDataType::VTYPE_STRING_SIZE_IS:
case nsIDataType::VTYPE_VOID: case nsIDataType::VTYPE_ASTRING: case nsIDataType::VTYPE_DOMSTRING: case nsIDataType::VTYPE_UTF8STRING: case nsIDataType::VTYPE_CSTRING: case nsIDataType::VTYPE_WSTRING_SIZE_IS: case nsIDataType::VTYPE_STRING_SIZE_IS:
static void FreeArray(nsDiscriminatedUnion* data){    NS_ASSERTION(data->mType == nsIDataType::VTYPE_ARRAY, "bad FreeArray call");    NS_ASSERTION(data->u.array.mArrayValue, "bad array");    NS_ASSERTION(data->u.array.mArrayCount, "bad array count");#define CASE__FREE_ARRAY_PTR(type_, ctype_)                                   \        case nsIDataType:: type_ :                                            \        {                                                                     \            ctype_ ** p = (ctype_ **) data->u.array.mArrayValue;              \            for(PRUint32 i = data->u.array.mArrayCount; i > 0; p++, i--)      \                if(*p)                                                        \                    nsMemory::Free((char*)*p);                                \            break;                                                            \        }#define CASE__FREE_ARRAY_IFACE(type_, ctype_)                                 \        case nsIDataType:: type_ :                                            \        {                                                                     \            ctype_ ** p = (ctype_ **) data->u.array.mArrayValue;              \            for(PRUint32 i = data->u.array.mArrayCount; i > 0; p++, i--)      \                if(*p)                                                        \                    (*p)->Release();                                          \            break;                                                            \        }        switch(data->u.array.mArrayType)    {        case nsIDataType::VTYPE_INT8:                case nsIDataType::VTYPE_INT16:                case nsIDataType::VTYPE_INT32:                case nsIDataType::VTYPE_INT64:                case nsIDataType::VTYPE_UINT8:                case nsIDataType::VTYPE_UINT16:                case nsIDataType::VTYPE_UINT32:                case nsIDataType::VTYPE_UINT64:                case nsIDataType::VTYPE_FLOAT:                case nsIDataType::VTYPE_DOUBLE:                case nsIDataType::VTYPE_BOOL:                case nsIDataType::VTYPE_CHAR:                case nsIDataType::VTYPE_WCHAR:                    break;        // XXX We ASSUME that "array of nsID" means "array of pointers to nsID".        CASE__FREE_ARRAY_PTR(VTYPE_ID, nsID)        CASE__FREE_ARRAY_PTR(VTYPE_CHAR_STR, char)        CASE__FREE_ARRAY_PTR(VTYPE_WCHAR_STR, PRUnichar)        CASE__FREE_ARRAY_IFACE(VTYPE_INTERFACE, nsISupports)        CASE__FREE_ARRAY_IFACE(VTYPE_INTERFACE_IS, nsISupports)        // The rest are illegal.        case nsIDataType::VTYPE_VOID:                case nsIDataType::VTYPE_ASTRING:                case nsIDataType::VTYPE_WSTRING_SIZE_IS:                case nsIDataType::VTYPE_STRING_SIZE_IS:                case nsIDataType::VTYPE_ARRAY:        case nsIDataType::VTYPE_EMPTY:        default:            NS_ERROR("bad type in array!");            break;    }        // Free the array memory.    nsMemory::Free((char*)data->u.array.mArrayValue);#undef CASE__FREE_ARRAY_PTR#undef CASE__FREE_ARRAY_IFACE}    