ruby-changes:17872
From: nobu <ko1@a...>
Date: Tue, 23 Nov 2010 22:02:25 +0900 (JST)
Subject: [ruby-changes:17872] Ruby:r29886 (trunk): * win32/win32.c (wlink, rb_w32_getppid): use typedef instead of
nobu 2010-11-23 21:59:50 +0900 (Tue, 23 Nov 2010) New Revision: 29886 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29886 Log: * win32/win32.c (wlink, rb_w32_getppid): use typedef instead of repeating compilcated function prototypes. Modified files: trunk/ChangeLog trunk/win32/win32.c Index: ChangeLog =================================================================== --- ChangeLog (revision 29885) +++ ChangeLog (revision 29886) @@ -1,3 +1,8 @@ +Tue Nov 23 21:59:47 2010 Nobuyoshi Nakada <nobu@r...> + + * win32/win32.c (wlink, rb_w32_getppid): use typedef instead of + repeating compilcated function prototypes. + Tue Nov 23 18:54:03 2010 Nobuyoshi Nakada <nobu@r...> * vm.c (rb_thread_mark): should mark self in conrol Index: win32/win32.c =================================================================== --- win32/win32.c (revision 29885) +++ win32/win32.c (revision 29886) @@ -3815,11 +3815,12 @@ static int wlink(const WCHAR *from, const WCHAR *to) { - static BOOL (WINAPI *pCreateHardLinkW)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES) = NULL; + typedef BOOL (WINAPI link_func)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES); + static link_func *pCreateHardLinkW = NULL; static int myerrno = 0; if (!pCreateHardLinkW && !myerrno) { - pCreateHardLinkW = (BOOL (WINAPI *)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES))get_proc_address("kernel32", "CreateHardLinkW", NULL); + pCreateHardLinkW = (link_func *)get_proc_address("kernel32", "CreateHardLinkW", NULL); if (!pCreateHardLinkW) myerrno = ENOSYS; } @@ -4662,12 +4663,13 @@ rb_pid_t rb_w32_getppid(void) { - static long (WINAPI *pNtQueryInformationProcess)(HANDLE, int, void *, ULONG, ULONG *) = NULL; + typedef long (WINAPI query_func)(HANDLE, int, void *, ULONG, ULONG *); + static query_func *pNtQueryInformationProcess = NULL; rb_pid_t ppid = 0; if (!IsWin95() && rb_w32_osver() >= 5) { if (!pNtQueryInformationProcess) - pNtQueryInformationProcess = (long (WINAPI *)(HANDLE, int, void *, ULONG, ULONG *))get_proc_address("ntdll.dll", "NtQueryInformationProcess", NULL); + pNtQueryInformationProcess = (query_func *)get_proc_address("ntdll.dll", "NtQueryInformationProcess", NULL); if (pNtQueryInformationProcess) { struct { long ExitStatus; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/