From: Nicholas Clark Date: Wed, 8 Jun 2005 08:07:05 +0000 (+0000) Subject: Convert POPpx POPpconstx and POPpbytex to use nolen macros. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8c074e2aa6f4be490d6bedf1bc337b09fa1c1185;p=p5sagit%2Fp5-mst-13.2.git Convert POPpx POPpconstx and POPpbytex to use nolen macros. Elminate a lot of Cs p4raw-id: //depot/perl@24748 --- diff --git a/pp.h b/pp.h index dec43c7..1ca2fab 100644 --- a/pp.h +++ b/pp.h @@ -98,16 +98,13 @@ See C and L for other uses. Pops an SV off the stack. =for apidoc Amn|char*|POPp -Pops a string off the stack. Deprecated. New code should provide -a STRLEN n_a and use POPpx. +Pops a string off the stack. Deprecated. New code should use POPpx. =for apidoc Amn|char*|POPpx Pops a string off the stack. -Requires a variable STRLEN n_a in scope. =for apidoc Amn|char*|POPpbytex Pops a string off the stack which must consist of bytes i.e. characters < 256. -Requires a variable STRLEN n_a in scope. =for apidoc Amn|NV|POPn Pops a double off the stack. @@ -128,9 +125,9 @@ Pops a long off the stack. #define POPs (*sp--) #define POPp (SvPVx(POPs, PL_na)) /* deprecated */ -#define POPpx (SvPVx(POPs, n_a)) -#define POPpconstx (SvPVx_const(POPs, n_a)) -#define POPpbytex (SvPVbytex(POPs, n_a)) +#define POPpx (SvPVx_nolen(POPs)) +#define POPpconstx (SvPVx_nolen_const(POPs)) +#define POPpbytex (SvPVbytex_nolen(POPs)) #define POPn (SvNVx(POPs)) #define POPi ((IV)SvIVx(POPs)) #define POPu ((UV)SvUVx(POPs)) diff --git a/pp_ctl.c b/pp_ctl.c index 3dd92b7..0d0899a 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1702,7 +1702,6 @@ PP(pp_reset) { dSP; const char *tmps; - STRLEN n_a; if (MAXARG < 1) tmps = ""; diff --git a/pp_sys.c b/pp_sys.c index 3c0b56a..a0aa747 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -321,7 +321,6 @@ PP(pp_backtick) { dSP; dTARGET; PerlIO *fp; - STRLEN n_a; const char *tmps = POPpconstx; const I32 gimme = GIMME_V; const char *mode = "r"; @@ -2931,7 +2930,6 @@ PP(pp_ftrread) STACKED_FTEST_CHECK; #if defined(HAS_ACCESS) && defined(R_OK) if ((PL_op->op_private & OPpFT_ACCESS) && SvPOK(TOPs)) { - STRLEN n_a; result = access(POPpx, R_OK); if (result == 0) RETPUSHYES; @@ -2959,7 +2957,6 @@ PP(pp_ftrwrite) STACKED_FTEST_CHECK; #if defined(HAS_ACCESS) && defined(W_OK) if ((PL_op->op_private & OPpFT_ACCESS) && SvPOK(TOPs)) { - STRLEN n_a; result = access(POPpx, W_OK); if (result == 0) RETPUSHYES; @@ -2987,7 +2984,6 @@ PP(pp_ftrexec) STACKED_FTEST_CHECK; #if defined(HAS_ACCESS) && defined(X_OK) if ((PL_op->op_private & OPpFT_ACCESS) && SvPOK(TOPs)) { - STRLEN n_a; result = access(POPpx, X_OK); if (result == 0) RETPUSHYES; @@ -3071,7 +3067,6 @@ PP(pp_fteexec) STACKED_FTEST_CHECK; #ifdef PERL_EFF_ACCESS_X_OK if ((PL_op->op_private & OPpFT_ACCESS) && SvPOK(TOPs)) { - STRLEN n_a; result = PERL_EFF_ACCESS_X_OK(POPpx); if (result == 0) RETPUSHYES; @@ -3358,8 +3353,7 @@ PP(pp_fttty) if (GvIO(gv) && IoIFP(GvIOp(gv))) fd = PerlIO_fileno(IoIFP(GvIOp(gv))); else if (tmpsv && SvOK(tmpsv)) { - STRLEN n_a; - char *tmps = SvPV(tmpsv, n_a); + char *tmps = SvPV_nolen(tmpsv); if (isDIGIT(*tmps)) fd = atoi(tmps); else @@ -3391,7 +3385,6 @@ PP(pp_fttext) register IO *io; register SV *sv; GV *gv; - STRLEN n_a; PerlIO *fp; STACKED_FTEST_CHECK; @@ -3460,9 +3453,9 @@ PP(pp_fttext) really_filename: PL_statgv = Nullgv; PL_laststype = OP_STAT; - sv_setpv(PL_statname, SvPV(sv, n_a)); + sv_setpv(PL_statname, SvPV_nolen(sv)); if (!(fp = PerlIO_open(SvPVX_const(PL_statname), "r"))) { - if (ckWARN(WARN_NEWLINE) && strchr(SvPV(PL_statname, n_a), '\n')) + if (ckWARN(WARN_NEWLINE) && strchr(SvPV_nolen(PL_statname), '\n')) Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "open"); RETPUSHUNDEF; } @@ -3548,7 +3541,6 @@ PP(pp_chdir) dSP; dTARGET; const char *tmps; SV **svp; - STRLEN n_a; if( MAXARG == 1 ) tmps = POPpconstx; @@ -3565,7 +3557,7 @@ PP(pp_chdir) { if( MAXARG == 1 ) deprecate("chdir('') or chdir(undef) as chdir()"); - tmps = SvPV_const(*svp, n_a); + tmps = SvPV_nolen_const(*svp); } else { PUSHi(0); @@ -3602,7 +3594,6 @@ PP(pp_chroot) { #ifdef HAS_CHROOT dSP; dTARGET; - STRLEN n_a; char *tmps = POPpx; TAINT_PROPER("chroot"); PUSHi( chroot(tmps) >= 0 ); @@ -3646,7 +3637,6 @@ PP(pp_rename) { dSP; dTARGET; int anum; - STRLEN n_a; const char *tmps2 = POPpconstx; const char *tmps = SvPV_nolen_const(TOPs); TAINT_PROPER("rename"); @@ -3672,7 +3662,6 @@ PP(pp_link) { #ifdef HAS_LINK dSP; dTARGET; - STRLEN n_a; const char *tmps2 = POPpconstx; const char *tmps = SvPV_nolen_const(TOPs); TAINT_PROPER("link"); @@ -3687,7 +3676,6 @@ PP(pp_symlink) { #ifdef HAS_SYMLINK dSP; dTARGET; - STRLEN n_a; const char *tmps2 = POPpconstx; const char *tmps = SvPV_nolen_const(TOPs); TAINT_PROPER("symlink"); @@ -3706,7 +3694,6 @@ PP(pp_readlink) const char *tmps; char buf[MAXPATHLEN]; int len; - STRLEN n_a; #ifndef INCOMPLETE_TAINTS TAINT; @@ -3888,7 +3875,6 @@ PP(pp_open_dir) { #if defined(Direntry_t) && defined(HAS_READDIR) dSP; - STRLEN n_a; const char *dirname = POPpconstx; GV *gv = (GV*)POPs; register IO *io = GvIOn(gv); @@ -4174,7 +4160,6 @@ PP(pp_system) { dSP; dMARK; dORIGMARK; dTARGET; I32 value; - STRLEN n_a; int result; if (PL_tainting) { @@ -4265,7 +4250,7 @@ PP(pp_system) else if (SP - MARK != 1) value = (I32)do_aexec5(Nullsv, MARK, SP, pp[1], did_pipes); else { - value = (I32)do_exec3(SvPVx(sv_mortalcopy(*SP), n_a), pp[1], did_pipes); + value = (I32)do_exec3(SvPVx_nolen(sv_mortalcopy(*SP)), pp[1], did_pipes); } PerlProc__exit(-1); } @@ -4288,7 +4273,7 @@ PP(pp_system) # endif } else { - value = (I32)do_spawn(SvPVx(sv_mortalcopy(*SP), n_a)); + value = (I32)do_spawn(SvPVx_nolen(sv_mortalcopy(*SP))); } if (PL_statusvalue == -1) /* hint that value must be returned as is */ result = 1; @@ -4304,7 +4289,6 @@ PP(pp_exec) { dSP; dMARK; dORIGMARK; dTARGET; I32 value; - STRLEN n_a; if (PL_tainting) { TAINT_ENV(); @@ -4336,13 +4320,13 @@ PP(pp_exec) #endif else { #ifdef VMS - value = (I32)vms_do_exec(SvPVx(sv_mortalcopy(*SP), n_a)); + value = (I32)vms_do_exec(SvPVx_nolen(sv_mortalcopy(*SP))); #else # ifdef __OPEN_VM - (void) do_spawn(SvPVx(sv_mortalcopy(*SP), n_a)); + (void) do_spawn(SvPVx_nolen(sv_mortalcopy(*SP))); value = 0; # else - value = (I32)do_exec(SvPVx(sv_mortalcopy(*SP), n_a)); + value = (I32)do_exec(SvPVx_nolen(sv_mortalcopy(*SP))); # endif #endif } @@ -4769,7 +4753,6 @@ PP(pp_ghostent) #endif struct hostent *hent; unsigned long len; - STRLEN n_a; EXTEND(SP, 10); if (which == OP_GHBYNAME) { @@ -4885,7 +4868,6 @@ PP(pp_gnetent) struct netent *getnetent(void); #endif struct netent *nent; - STRLEN n_a; if (which == OP_GNBYNAME){ #ifdef HAS_GETNETBYNAME @@ -4986,7 +4968,6 @@ PP(pp_gprotoent) struct protoent *getprotoent(void); #endif struct protoent *pent; - STRLEN n_a; if (which == OP_GPBYNAME) { #ifdef HAS_GETPROTOBYNAME @@ -5073,7 +5054,6 @@ PP(pp_gservent) struct servent *getservent(void); #endif struct servent *sent; - STRLEN n_a; if (which == OP_GSBYNAME) { #ifdef HAS_GETSERVBYNAME @@ -5269,7 +5249,6 @@ PP(pp_gpwent) dSP; I32 which = PL_op->op_type; register SV *sv; - STRLEN n_a; struct passwd *pwent = NULL; /* * We currently support only the SysV getsp* shadow password interface. @@ -5548,7 +5527,6 @@ PP(pp_ggrent) register char **elem; register SV *sv; struct group *grent; - STRLEN n_a; if (which == OP_GGRNAM) { char* name = POPpbytex;