summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cygwin/cygwin.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/cygwin/cygwin.c b/cygwin/cygwin.c
index ceb2e816db..18d4db5425 100644
--- a/cygwin/cygwin.c
+++ b/cygwin/cygwin.c
@@ -160,11 +160,14 @@ static
XS(XS_Cygwin_pid_to_winpid)
{
dXSARGS;
+ dXSTARG;
+ pid_t pid, RETVAL;
+
if (items != 1)
Perl_croak(aTHX_ "Usage: Cygwin::pid_to_winpid(pid)");
- pid_t pid = (pid_t)SvIV(ST(0));
- pid_t RETVAL;
- dXSTARG;
+
+ pid = (pid_t)SvIV(ST(0));
+
if ((RETVAL = cygwin_internal(CW_CYGWIN_PID_TO_WINPID, pid)) > 0) {
XSprePUSH; PUSHi((IV)RETVAL);
XSRETURN(1);
@@ -176,11 +179,14 @@ static
XS(XS_Cygwin_winpid_to_pid)
{
dXSARGS;
+ dXSTARG;
+ pid_t pid, RETVAL;
+
if (items != 1)
Perl_croak(aTHX_ "Usage: Cygwin::winpid_to_pid(pid)");
- pid_t pid = (pid_t)SvIV(ST(0));
- pid_t RETVAL;
- dXSTARG;
+
+ pid = (pid_t)SvIV(ST(0));
+
if ((RETVAL = cygwin32_winpid_to_pid(pid)) > 0) {
XSprePUSH; PUSHi((IV)RETVAL);
XSRETURN(1);