ruby-changes:52832
From: k0kubun <ko1@a...>
Date: Sat, 13 Oct 2018 08:57:47 +0900 (JST)
Subject: [ruby-changes:52832] k0kubun:r65044 (trunk): win32/win32.c: drop always-NULL psa parameter
k0kubun 2018-10-13 08:57:42 +0900 (Sat, 13 Oct 2018) New Revision: 65044 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65044 Log: win32/win32.c: drop always-NULL psa parameter I'm simplifying the interface of ChildRecord as I'm going to complicate it a little next. I didn't drop hInput since leaving it would be more natural as its interface. Modified files: trunk/win32/win32.c Index: win32/win32.c =================================================================== --- win32/win32.c (revision 65043) +++ win32/win32.c (revision 65044) @@ -119,7 +119,7 @@ static char *w32_getenv(const char *name https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L119 int rb_w32_reparse_symlink_p(const WCHAR *path); -static struct ChildRecord *CreateChild(const WCHAR *, const WCHAR *, SECURITY_ATTRIBUTES *, HANDLE, HANDLE, HANDLE, DWORD); +static struct ChildRecord *CreateChild(const WCHAR *, const WCHAR *, HANDLE, HANDLE, HANDLE, DWORD); static int has_redirection(const char *, UINT); int rb_w32_wait_events(HANDLE *events, int num, DWORD timeout); static int rb_w32_open_osfhandle(intptr_t osfhandle, int flags); @@ -1197,8 +1197,7 @@ child_result(struct ChildRecord *child, https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1197 /* License: Ruby's */ static struct ChildRecord * -CreateChild(const WCHAR *cmd, const WCHAR *prog, SECURITY_ATTRIBUTES *psa, - HANDLE hInput, HANDLE hOutput, HANDLE hError, DWORD dwCreationFlags) +CreateChild(const WCHAR *cmd, const WCHAR *prog, HANDLE hInput, HANDLE hOutput, HANDLE hError, DWORD dwCreationFlags) { BOOL fRet; STARTUPINFOW aStartupInfo; @@ -1217,12 +1216,9 @@ CreateChild(const WCHAR *cmd, const WCHA https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1216 return NULL; } - if (!psa) { - sa.nLength = sizeof (SECURITY_ATTRIBUTES); - sa.lpSecurityDescriptor = NULL; - sa.bInheritHandle = TRUE; - psa = &sa; - } + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; memset(&aStartupInfo, 0, sizeof(aStartupInfo)); memset(&aProcessInformation, 0, sizeof(aProcessInformation)); @@ -1256,8 +1252,8 @@ CreateChild(const WCHAR *cmd, const WCHA https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1252 } RUBY_CRITICAL { - fRet = CreateProcessW(prog, (WCHAR *)cmd, psa, psa, - psa->bInheritHandle, dwCreationFlags, NULL, NULL, + fRet = CreateProcessW(prog, (WCHAR *)cmd, &sa, &sa, + sa.bInheritHandle, dwCreationFlags, NULL, NULL, &aStartupInfo, &aProcessInformation); errno = map_errno(GetLastError()); } @@ -1328,7 +1324,7 @@ rb_w32_start_process(const char *abspath https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1324 return 0; } - child = CreateChild(wcmd, wprog, NULL, NULL, outHandle, outHandle, 0); + child = CreateChild(wcmd, wprog, NULL, outHandle, outHandle, 0); if (child == NULL) { return 0; } @@ -1455,7 +1451,7 @@ w32_spawn(int mode, const char *cmd, con https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1451 if (v) ALLOCV_END(v); if (!e) { - ret = child_result(CreateChild(wcmd, wshell, NULL, NULL, NULL, NULL, 0), mode); + ret = child_result(CreateChild(wcmd, wshell, NULL, NULL, NULL, 0), mode); } free(wshell); free(wcmd); @@ -1540,7 +1536,7 @@ w32_aspawn_flags(int mode, const char *p https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1536 if (!e && prog && !(wprog = mbstr_to_wstr(cp, prog, -1, NULL))) e = E2BIG; if (!e) { - ret = child_result(CreateChild(wcmd, wprog, NULL, NULL, NULL, NULL, flags), mode); + ret = child_result(CreateChild(wcmd, wprog, NULL, NULL, NULL, flags), mode); } free(wprog); free(wcmd); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/