Mercurial > pidgin
comparison src/win32/libc_interface.c @ 13338:0f708ed02902
[gaim-migrate @ 15708]
Daniel and I figured it would be a good idea to cache the results of the registry lookup. For the kind of code using gaim_utf8_strftime() right now, this gets us down to one registry search per Gaim instance on localized versions of Windows (zero on English versions).
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 27 Feb 2006 19:31:30 +0000 |
parents | b04212d6b115 |
children | c6ab9c1cf28d |
comparison
equal
deleted
inserted
replaced
13337:d4af79bc2d0a | 13338:0f708ed02902 |
---|---|
462 const char *wdst; /* Windows name of daylight timezone */ | 462 const char *wdst; /* Windows name of daylight timezone */ |
463 const char *ustd; /* Unix name of standard timezone */ | 463 const char *ustd; /* Unix name of standard timezone */ |
464 const char *udst; /* Unix name of daylight timezone */ | 464 const char *udst; /* Unix name of daylight timezone */ |
465 } win32_tzmap[] = | 465 } win32_tzmap[] = |
466 { | 466 { |
467 { | |
468 "", "", | |
469 "", "", | |
470 }, | |
467 /* | 471 /* |
468 * This list was built from the contents of the registry at | 472 * This list was built from the contents of the registry at |
469 * "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones" | 473 * "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones" |
470 * on Windows XP Professional SP1 | 474 * on Windows XP Professional SP1 |
471 */ | 475 */ |
922 { | 926 { |
923 if (strcmp(localtzname, win32_tzmap[i].wstd) == 0) | 927 if (strcmp(localtzname, win32_tzmap[i].wstd) == 0) |
924 { | 928 { |
925 gaim_debug_info("wgaim", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")", | 929 gaim_debug_info("wgaim", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")", |
926 win32_tzmap[i].ustd, tzname, localtzname); | 930 win32_tzmap[i].ustd, tzname, localtzname); |
931 | |
932 /* Cache the Result */ | |
933 if (win32_tzmap[0].wstd[0] != '\0') | |
934 g_free(win32_tzmap[0].wstd); | |
935 win32_tzmap[0].wstd = g_strdup(tzname); | |
936 win32_tzmap[1].ustd = win32_tzmap[i].ustd; | |
937 | |
927 return win32_tzmap[i].ustd; | 938 return win32_tzmap[i].ustd; |
928 } | 939 } |
929 if (strcmp(localtzname, win32_tzmap[i].wdst) == 0) | 940 if (strcmp(localtzname, win32_tzmap[i].wdst) == 0) |
930 { | 941 { |
931 gaim_debug_info("wgaim", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")", | 942 gaim_debug_info("wgaim", "TZ \"%s\" matches localized Windows timezone \"%s\" (\"%s\")", |
932 win32_tzmap[i].udst, tzname, localtzname); | 943 win32_tzmap[i].udst, tzname, localtzname); |
944 | |
945 /* Cache the Result */ | |
946 if (win32_tzmap[0].wdst[0] != '\0') | |
947 g_free(win32_tzmap[0].wdst); | |
948 | |
949 win32_tzmap[0].wdst = g_strdup(tzname); | |
950 win32_tzmap[1].udst = win32_tzmap[i].udst; | |
951 | |
933 return win32_tzmap[i].udst; | 952 return win32_tzmap[i].udst; |
934 } | 953 } |
935 } | 954 } |
936 } | 955 } |
937 | 956 |
938 gaim_debug_warning("wgaim", "could not find a match for Windows timezone \"%s\"", tzname); | 957 gaim_debug_warning("wgaim", "could not find a match for Windows timezone \"%s\"", tzname); |
939 return ""; | 958 return ""; |
940 } | 959 } |
960 |