From: Gurusamy Sarathy Date: Mon, 2 Jul 2001 08:03:55 +0000 (+0000) Subject: rename s/sv_getcwd/getcwd_sv/ for better conformance to existing X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=894237640a8731055a749592e01318892443c38d;p=p5sagit%2Fp5-mst-13.2.git rename s/sv_getcwd/getcwd_sv/ for better conformance to existing naming discipline win32 fix: enable getcwd_sv() to work on windows (POSIX.t was failing because of this) fix a warning about "fd" being used without being set in Cwd.xs p4raw-id: //depot/perl@11067 --- diff --git a/embed.h b/embed.h index 42013a1..96a9dd7 100644 --- a/embed.h +++ b/embed.h @@ -671,7 +671,7 @@ #define sv_collxfrm Perl_sv_collxfrm #endif #define sv_compile_2op Perl_sv_compile_2op -#define sv_getcwd Perl_sv_getcwd +#define getcwd_sv Perl_getcwd_sv #define sv_dec Perl_sv_dec #define sv_dump Perl_sv_dump #define sv_derived_from Perl_sv_derived_from @@ -2178,7 +2178,7 @@ #define sv_collxfrm(a,b) Perl_sv_collxfrm(aTHX_ a,b) #endif #define sv_compile_2op(a,b,c,d) Perl_sv_compile_2op(aTHX_ a,b,c,d) -#define sv_getcwd(a) Perl_sv_getcwd(aTHX_ a) +#define getcwd_sv(a) Perl_getcwd_sv(aTHX_ a) #define sv_dec(a) Perl_sv_dec(aTHX_ a) #define sv_dump(a) Perl_sv_dump(aTHX_ a) #define sv_derived_from(a,b) Perl_sv_derived_from(aTHX_ a,b) @@ -4279,8 +4279,8 @@ #endif #define Perl_sv_compile_2op CPerlObj::Perl_sv_compile_2op #define sv_compile_2op Perl_sv_compile_2op -#define Perl_sv_getcwd CPerlObj::Perl_sv_getcwd -#define sv_getcwd Perl_sv_getcwd +#define Perl_getcwd_sv CPerlObj::Perl_getcwd_sv +#define getcwd_sv Perl_getcwd_sv #define Perl_sv_dec CPerlObj::Perl_sv_dec #define sv_dec Perl_sv_dec #define Perl_sv_dump CPerlObj::Perl_sv_dump diff --git a/embed.pl b/embed.pl index 9ad4767..ca061f4 100755 --- a/embed.pl +++ b/embed.pl @@ -2031,7 +2031,7 @@ Apd |I32 |sv_cmp_locale |SV* sv1|SV* sv2 Apd |char* |sv_collxfrm |SV* sv|STRLEN* nxp #endif Ap |OP* |sv_compile_2op |SV* sv|OP** startp|char* code|AV** avp -Apd |int |sv_getcwd |SV* sv +Apd |int |getcwd_sv |SV* sv Apd |void |sv_dec |SV* sv Ap |void |sv_dump |SV* sv Apd |bool |sv_derived_from|SV* sv|const char* name diff --git a/ext/Cwd/Cwd.xs b/ext/Cwd/Cwd.xs index be9427b..b6f27b8 100644 --- a/ext/Cwd/Cwd.xs +++ b/ext/Cwd/Cwd.xs @@ -194,7 +194,11 @@ err1: serrno = errno; #else (void)chdir(wd); #endif -err2: (void)close(fd); + +err2: +#ifdef HAS_FCHDIR + (void)close(fd); +#endif errno = serrno; return (NULL); #endif @@ -209,7 +213,7 @@ fastcwd() PPCODE: { dXSTARG; - sv_getcwd(TARG); + getcwd_sv(TARG); XSprePUSH; PUSHTARG; } diff --git a/ext/POSIX/POSIX.t b/ext/POSIX/POSIX.t index aae4cf3..87a2aea 100755 --- a/ext/POSIX/POSIX.t +++ b/ext/POSIX/POSIX.t @@ -79,7 +79,7 @@ if ($Is_MPE) { print &_POSIX_OPEN_MAX > $fds[1] ? "ok 12\n" : "not ok 12\n" } -print getcwd() =~ m#/t$# ? "ok 13\n" : "not ok 13\n"; +print getcwd() =~ m#[/\\]t$# ? "ok 13\n" : "not ok 13\n"; # Check string conversion functions. diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 6f27ea3..1bf8521 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1751,7 +1751,7 @@ getcwd() PPCODE: { dXSTARG; - sv_getcwd(TARG); + getcwd_sv(TARG); XSprePUSH; PUSHTARG; } diff --git a/global.sym b/global.sym index 50b6bd1..5301739 100644 --- a/global.sym +++ b/global.sym @@ -413,7 +413,7 @@ Perl_sv_cmp Perl_sv_cmp_locale Perl_sv_collxfrm Perl_sv_compile_2op -Perl_sv_getcwd +Perl_getcwd_sv Perl_sv_dec Perl_sv_dump Perl_sv_derived_from diff --git a/objXSUB.h b/objXSUB.h index 6c7dcdd..43a10fa 100644 --- a/objXSUB.h +++ b/objXSUB.h @@ -1657,10 +1657,10 @@ #define Perl_sv_compile_2op pPerl->Perl_sv_compile_2op #undef sv_compile_2op #define sv_compile_2op Perl_sv_compile_2op -#undef Perl_sv_getcwd -#define Perl_sv_getcwd pPerl->Perl_sv_getcwd -#undef sv_getcwd -#define sv_getcwd Perl_sv_getcwd +#undef Perl_getcwd_sv +#define Perl_getcwd_sv pPerl->Perl_getcwd_sv +#undef getcwd_sv +#define getcwd_sv Perl_getcwd_sv #undef Perl_sv_dec #define Perl_sv_dec pPerl->Perl_sv_dec #undef sv_dec diff --git a/perlapi.c b/perlapi.c index b554ed5..df16150 100644 --- a/perlapi.c +++ b/perlapi.c @@ -3002,11 +3002,11 @@ Perl_sv_compile_2op(pTHXo_ SV* sv, OP** startp, char* code, AV** avp) return ((CPerlObj*)pPerl)->Perl_sv_compile_2op(sv, startp, code, avp); } -#undef Perl_sv_getcwd +#undef Perl_getcwd_sv int -Perl_sv_getcwd(pTHXo_ SV* sv) +Perl_getcwd_sv(pTHXo_ SV* sv) { - return ((CPerlObj*)pPerl)->Perl_sv_getcwd(sv); + return ((CPerlObj*)pPerl)->Perl_getcwd_sv(sv); } #undef Perl_sv_dec diff --git a/pod/perlapi.pod b/pod/perlapi.pod index 0f46c22..4872a9f 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -475,6 +475,15 @@ L. =for hackers Found in file scope.h +=item getcwd_sv + +Fill the sv with current working directory + + int getcwd_sv(SV* sv) + +=for hackers +Found in file util.c + =item get_av Returns the AV of the specified Perl array. If C is set and the @@ -2225,22 +2234,22 @@ which guarantees to evaluate sv only once. =for hackers Found in file sv.h -=item SvNVX +=item SvNVx -Returns the raw value in the SV's NV slot, without checks or conversions. -Only use when you are sure SvNOK is true. See also C. +Coerces the given SV to a double and returns it. Guarantees to evaluate +sv only once. Use the more efficent C otherwise. - NV SvNVX(SV* sv) + NV SvNVx(SV* sv) =for hackers Found in file sv.h -=item SvNVx +=item SvNVX -Coerces the given SV to a double and returns it. Guarantees to evaluate -sv only once. Use the more efficent C otherwise. +Returns the raw value in the SV's NV slot, without checks or conversions. +Only use when you are sure SvNOK is true. See also C. - NV SvNVx(SV* sv) + NV SvNVX(SV* sv) =for hackers Found in file sv.h @@ -2434,21 +2443,21 @@ Like C, but converts sv to uft8 first if necessary. =for hackers Found in file sv.h -=item SvPVx +=item SvPVX -A version of C which guarantees to evaluate sv only once. +Returns a pointer to the physical string in the SV. The SV must contain a +string. - char* SvPVx(SV* sv, STRLEN len) + char* SvPVX(SV* sv) =for hackers Found in file sv.h -=item SvPVX +=item SvPVx -Returns a pointer to the physical string in the SV. The SV must contain a -string. +A version of C which guarantees to evaluate sv only once. - char* SvPVX(SV* sv) + char* SvPVx(SV* sv, STRLEN len) =for hackers Found in file sv.h @@ -2655,19 +2664,19 @@ false, defined or undefined. Does not handle 'get' magic. =for hackers Found in file sv.h -=item SvTYPE - -Returns the type of the SV. See C. +=item svtype - svtype SvTYPE(SV* sv) +An enum of flags for Perl types. These are found in the file B +in the C enum. Test these flags with the C macro. =for hackers Found in file sv.h -=item svtype +=item SvTYPE -An enum of flags for Perl types. These are found in the file B -in the C enum. Test these flags with the C macro. +Returns the type of the SV. See C. + + svtype SvTYPE(SV* sv) =for hackers Found in file sv.h @@ -2778,22 +2787,22 @@ for a version which guarantees to evaluate sv only once. =for hackers Found in file sv.h -=item SvUVx +=item SvUVX -Coerces the given SV to an unsigned integer and returns it. Guarantees to -evaluate sv only once. Use the more efficent C otherwise. +Returns the raw value in the SV's UV slot, without checks or conversions. +Only use when you are sure SvIOK is true. See also C. - UV SvUVx(SV* sv) + UV SvUVX(SV* sv) =for hackers Found in file sv.h -=item SvUVX +=item SvUVx -Returns the raw value in the SV's UV slot, without checks or conversions. -Only use when you are sure SvIOK is true. See also C. +Coerces the given SV to an unsigned integer and returns it. Guarantees to +evaluate sv only once. Use the more efficent C otherwise. - UV SvUVX(SV* sv) + UV SvUVx(SV* sv) =for hackers Found in file sv.h @@ -3205,15 +3214,6 @@ Normally called via a wrapper macro C. =for hackers Found in file sv.c -=item sv_getcwd - -Fill the sv with current working directory - - int sv_getcwd(SV* sv) - -=for hackers -Found in file util.c - =item sv_gets Get a line from the filehandle and store it into the SV, optionally diff --git a/proto.h b/proto.h index 2d6e432..ae4157c 100644 --- a/proto.h +++ b/proto.h @@ -755,7 +755,7 @@ PERL_CALLCONV I32 Perl_sv_cmp_locale(pTHX_ SV* sv1, SV* sv2); PERL_CALLCONV char* Perl_sv_collxfrm(pTHX_ SV* sv, STRLEN* nxp); #endif PERL_CALLCONV OP* Perl_sv_compile_2op(pTHX_ SV* sv, OP** startp, char* code, AV** avp); -PERL_CALLCONV int Perl_sv_getcwd(pTHX_ SV* sv); +PERL_CALLCONV int Perl_getcwd_sv(pTHX_ SV* sv); PERL_CALLCONV void Perl_sv_dec(pTHX_ SV* sv); PERL_CALLCONV void Perl_sv_dump(pTHX_ SV* sv); PERL_CALLCONV bool Perl_sv_derived_from(pTHX_ SV* sv, const char* name); diff --git a/util.c b/util.c index 1ab05e6..4b96250 100644 --- a/util.c +++ b/util.c @@ -3614,7 +3614,7 @@ return FALSE (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))) /* -=for apidoc sv_getcwd +=for apidoc getcwd_sv Fill the sv with current working directory @@ -3630,7 +3630,7 @@ Fill the sv with current working directory * back into. */ int -Perl_sv_getcwd(pTHX_ register SV *sv) +Perl_getcwd_sv(pTHX_ register SV *sv) { #ifndef PERL_MICRO diff --git a/win32/config.bc b/win32/config.bc index 16598d1..1356adc 100644 --- a/win32/config.bc +++ b/win32/config.bc @@ -153,7 +153,7 @@ d_fstatvfs='undef' d_fsync='undef' d_ftello='undef' d_ftime='define' -d_getcwd='undef' +d_getcwd='define' d_getespwnam='undef' d_getfsstat='undef' d_getgrent='undef' diff --git a/win32/config.gc b/win32/config.gc index 0bf588d..bd3f401 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -153,7 +153,7 @@ d_fstatvfs='undef' d_fsync='undef' d_ftello='undef' d_ftime='define' -d_getcwd='undef' +d_getcwd='define' d_getespwnam='undef' d_getfsstat='undef' d_getgrent='undef' diff --git a/win32/config.vc b/win32/config.vc index b5025fb..486c5e2 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -153,7 +153,7 @@ d_fstatvfs='undef' d_fsync='undef' d_ftello='undef' d_ftime='define' -d_getcwd='undef' +d_getcwd='define' d_getespwnam='undef' d_getfsstat='undef' d_getgrent='undef'