[PATCH 5/6] mshtml: Use an event mask and list in XMLHttpReqEventListener.

Gabriel Ivăncescu gabrielopcode at gmail.com
Mon May 23 12:41:32 CDT 2022


On 23/05/2022 19:09, Jacek Caban wrote:
> Hi Gabriel,
> 
> On 5/23/22 17:22, Gabriel Ivăncescu wrote:
>> Instead of hardcoding each event, since there will be plenty more.
> 
> 
> What's an example of those missing ones?
> 

It's not in this patch series, but IE10+ modes will additionally need:

abort, error, loadstart, loadend, progress

>> Signed-off-by: Gabriel Ivăncescu<gabrielopcode at gmail.com>
>> ---
>>   dlls/mshtml/xmlhttprequest.c | 47 +++++++++++++++++++-----------------
>>   1 file changed, 25 insertions(+), 22 deletions(-)
>>
>> diff --git a/dlls/mshtml/xmlhttprequest.c b/dlls/mshtml/xmlhttprequest.c
>> index b9f6f1f..baef36e 100644
>> --- a/dlls/mshtml/xmlhttprequest.c
>> +++ b/dlls/mshtml/xmlhttprequest.c
>> @@ -94,12 +94,23 @@ static HRESULT return_nscstr(nsresult nsres, 
>> nsACString *nscstr, BSTR *p)
>>       return S_OK;
>>   }
>> +#define EVENTS_LIST \
>> +    X(readystatechange) \
>> +    X(load)
>> +
>> +#undef X
>> +#define X(event) EVENT_##event,
>> +enum { EVENTS_LIST };
>> +#undef X
>> +#define X(event) L"" #event,
>> +static const WCHAR *events[] = { EVENTS_LIST };
>> +#undef X
> 
> 
> You could avoid all those preprocessor directives by simply using an 
> array of structs.
> 

The problem is the first one is an enum, while second one is actual 
data, so I can't use a struct to unify this. I wanted to keep it easily 
in sync, but I can of course separate them without preprocessor if you 
prefer.



More information about the wine-devel mailing list