[PATCH] Cache localised number chars
Robert Shearman
rob at codeweavers.com
Tue May 13 12:57:18 CDT 2008
Michael Karcher wrote:
> UDATE *lpUdate)
> static void VARIANT_GetLocalisedNumberChars(VARIANT_NUMBER_CHARS *lpChars, LCID lcid, DWORD dwFlags)
> {
> static const VARIANT_NUMBER_CHARS defaultChars = { '-','+','.',',','$',0,'.',',' };
> + static VARIANT_NUMBER_CHARS lastChars;
> + static LCID lastLcid = -1;
> + static DWORD lastFlags = 0;
> LCTYPE lctype = dwFlags & LOCALE_NOUSEROVERRIDE;
> WCHAR buff[4];
>
> + /* Asking for default locale entries is very expensive: It is a registry
> + server call. So cache one localy, as Microsoft does it too */
> + if(lcid == lastLcid && dwFlags == lastFlags)
> + {
> + memcpy(lpChars, &lastChars, sizeof(defaultChars));
> + return;
> + }
> +
>
This introduces a race condition.
--
Rob Shearman
More information about the wine-devel
mailing list