summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>1999-02-18 20:14:07 +0100
committerGurusamy Sarathy <gsar@cpan.org>1999-02-20 00:30:48 +0000
commitbb897dfcf82adc653513b0b92523fb44767a9837 (patch)
tree986073f249ed37f26e10165314f4f72072f4f032 /win32
parent69077c198dfdd5c66fda335f6260797625fad59f (diff)
downloadperl-bb897dfcf82adc653513b0b92523fb44767a9837.tar.gz
resend [PATCH 5.005_55] Various win32/win32.c cleanup
Message-ID: <36d15809.40853323@smtp1.ibm.net> p4raw-id: //depot/perl@2990
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c65
1 files changed, 36 insertions, 29 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 408215c1ff..4ed826715f 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -471,7 +471,6 @@ do_aspawn(void *vreally, void **vmark, void **vsp)
int status;
int flag = P_WAIT;
int index = 0;
- STRLEN n_a;
if (sp <= mark)
return -1;
@@ -485,7 +484,7 @@ do_aspawn(void *vreally, void **vmark, void **vsp)
}
while (++mark <= sp) {
- if (*mark && (str = SvPV(*mark, n_a)))
+ if (*mark && (str = SvPV_nolen(*mark)))
argv[index++] = str;
else
argv[index++] = "";
@@ -493,7 +492,7 @@ do_aspawn(void *vreally, void **vmark, void **vsp)
argv[index++] = 0;
status = win32_spawnvp(flag,
- (const char*)(really ? SvPV(really,n_a) : argv[0]),
+ (const char*)(really ? SvPV_nolen(really) : argv[0]),
(const char* const*)argv);
if (status < 0 && (errno == ENOEXEC || errno == ENOENT)) {
@@ -506,7 +505,7 @@ do_aspawn(void *vreally, void **vmark, void **vsp)
argv[sh_items] = w32_perlshell_vec[sh_items];
status = win32_spawnvp(flag,
- (const char*)(really ? SvPV(really,n_a) : argv[0]),
+ (const char*)(really ? SvPV_nolen(really) : argv[0]),
(const char* const*)argv);
}
@@ -2235,21 +2234,22 @@ XS(w32_GetCwd)
* then it worked, set PV valid,
* else leave it 'undef'
*/
- if (SvCUR(sv))
+ if (SvCUR(sv)) {
SvPOK_on(sv);
- EXTEND(SP,1);
- ST(0) = sv;
- XSRETURN(1);
+ EXTEND(SP,1);
+ ST(0) = sv;
+ XSRETURN(1);
+ }
+ XSRETURN_EMPTY;
}
static
XS(w32_SetCwd)
{
dXSARGS;
- STRLEN n_a;
if (items != 1)
croak("usage: Win32::SetCurrentDirectory($cwd)");
- if (SetCurrentDirectory(SvPV(ST(0),n_a)))
+ if (SetCurrentDirectory(SvPV_nolen(ST(0))))
XSRETURN_YES;
XSRETURN_NO;
@@ -2265,16 +2265,18 @@ XS(w32_GetNextAvailDrive)
root[0] = ix++;
if (GetDriveType(root) == 1) {
root[2] = '\0';
+ EXTEND(SP,1);
XSRETURN_PV(root);
}
}
- XSRETURN_UNDEF;
+ XSRETURN_EMPTY;
}
static
XS(w32_GetLastError)
{
dXSARGS;
+ EXTEND(SP,1);
XSRETURN_IV(GetLastError());
}
@@ -2285,7 +2287,7 @@ XS(w32_SetLastError)
if (items != 1)
croak("usage: Win32::SetLastError($error)");
SetLastError(SvIV(ST(0)));
- XSRETURN_UNDEF;
+ XSRETURN_EMPTY;
}
static
@@ -2295,11 +2297,12 @@ XS(w32_LoginName)
char *name = getlogin_buffer;
DWORD size = sizeof(getlogin_buffer);
if (GetUserName(name,&size)) {
+ EXTEND(SP,1);
/* size includes NULL */
ST(0) = sv_2mortal(newSVpv(name,size-1));
XSRETURN(1);
}
- XSRETURN_UNDEF;
+ XSRETURN_EMPTY;
}
static
@@ -2309,11 +2312,12 @@ XS(w32_NodeName)
char name[MAX_COMPUTERNAME_LENGTH+1];
DWORD size = sizeof(name);
if (GetComputerName(name,&size)) {
+ EXTEND(SP,1);
/* size does NOT include NULL :-( */
ST(0) = sv_2mortal(newSVpv(name,size));
XSRETURN(1);
}
- XSRETURN_UNDEF;
+ XSRETURN_EMPTY;
}
@@ -2333,6 +2337,7 @@ XS(w32_DomainName)
SID_NAME_USE snu;
if (LookupAccountName(NULL, name, (PSID)&sid, &sidlen,
dname, &dnamelen, &snu)) {
+ EXTEND(SP,1);
XSRETURN_PV(dname); /* all that for this */
}
}
@@ -2353,10 +2358,11 @@ XS(w32_DomainName)
-1, (LPSTR)dname, dnamelen, NULL, NULL);
}
NetApiBufferFree(pwi);
+ EXTEND(SP,1);
XSRETURN_PV(dname);
}
#endif
- XSRETURN_UNDEF;
+ XSRETURN_EMPTY;
}
static
@@ -2367,16 +2373,17 @@ XS(w32_FsType)
DWORD flags, filecomplen;
if (GetVolumeInformation(NULL, NULL, 0, NULL, &filecomplen,
&flags, fsname, sizeof(fsname))) {
- if (GIMME == G_ARRAY) {
+ if (GIMME_V == G_ARRAY) {
XPUSHs(sv_2mortal(newSVpv(fsname,0)));
XPUSHs(sv_2mortal(newSViv(flags)));
XPUSHs(sv_2mortal(newSViv(filecomplen)));
PUTBACK;
return;
}
+ EXTEND(SP,1);
XSRETURN_PV(fsname);
}
- XSRETURN_UNDEF;
+ XSRETURN_EMPTY;
}
static
@@ -2395,13 +2402,14 @@ XS(w32_GetOSVersion)
PUTBACK;
return;
}
- XSRETURN_UNDEF;
+ XSRETURN_EMPTY;
}
static
XS(w32_IsWinNT)
{
dXSARGS;
+ EXTEND(SP,1);
XSRETURN_IV(IsWinNT());
}
@@ -2409,6 +2417,7 @@ static
XS(w32_IsWin95)
{
dXSARGS;
+ EXTEND(SP,1);
XSRETURN_IV(IsWin95());
}
@@ -2427,7 +2436,7 @@ XS(w32_FormatMessage)
msgbuf, sizeof(msgbuf)-1, NULL))
XSRETURN_PV(msgbuf);
- XSRETURN_UNDEF;
+ XSRETURN_EMPTY;
}
static
@@ -2438,13 +2447,12 @@ XS(w32_Spawn)
PROCESS_INFORMATION stProcInfo;
STARTUPINFO stStartInfo;
BOOL bSuccess = FALSE;
- STRLEN n_a;
if (items != 3)
croak("usage: Win32::Spawn($cmdName, $args, $PID)");
- cmd = SvPV(ST(0),n_a);
- args = SvPV(ST(1), n_a);
+ cmd = SvPV_nolen(ST(0));
+ args = SvPV_nolen(ST(1));
memset(&stStartInfo, 0, sizeof(stStartInfo)); /* Clear the block */
stStartInfo.cb = sizeof(stStartInfo); /* Set the structure size */
@@ -2474,6 +2482,7 @@ static
XS(w32_GetTickCount)
{
dXSARGS;
+ EXTEND(SP,1);
XSRETURN_IV(GetTickCount());
}
@@ -2498,10 +2507,9 @@ XS(w32_GetShortPathName)
if (len) {
SvCUR_set(shortpath,len);
ST(0) = shortpath;
+ XSRETURN(1);
}
- else
- ST(0) = &PL_sv_undef;
- XSRETURN(1);
+ XSRETURN_EMPTY;
}
static
@@ -2528,16 +2536,15 @@ XS(w32_GetFullPathName)
if (len) {
if (GIMME_V == G_ARRAY) {
EXTEND(SP,1);
- ST(1) = sv_2mortal(newSVpv(filepart,0));
+ XST_mPV(1,filepart);
len = filepart - SvPVX(fullpath);
items = 2;
}
SvCUR_set(fullpath,len);
ST(0) = fullpath;
+ XSRETURN(items);
}
- else
- ST(0) = &PL_sv_undef;
- XSRETURN(items);
+ XSRETURN_EMPTY;
}
static