diff options
author | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-10-03 17:12:33 +0000 |
---|---|---|
committer | Malcolm Beattie <mbeattie@sable.ox.ac.uk> | 1997-10-03 17:12:33 +0000 |
commit | 968277801164b16eb55f9f8fd3162dc3b6226110 (patch) | |
tree | 9e3909d2149d62cac469cfb6d84bdfd4353dd19f | |
parent | 5d3fdfebb3d34f909dfbefe2c2cdf38bab171cf9 (diff) | |
download | perl-968277801164b16eb55f9f8fd3162dc3b6226110.tar.gz |
Remove last traces of "tokenbuf as temp buffer" and removed it
from struct thread. Added missing thr->Tfoo defines for statbuf
and timesbuf and removed unused Tbuf field.
p4raw-id: //depot/perl@106
-rw-r--r-- | doio.c | 7 | ||||
-rw-r--r-- | mg.c | 9 | ||||
-rw-r--r-- | perl.c | 1 | ||||
-rw-r--r-- | pp_sys.c | 3 | ||||
-rw-r--r-- | sv.c | 17 | ||||
-rw-r--r-- | thread.h | 6 |
6 files changed, 26 insertions, 17 deletions
@@ -283,6 +283,7 @@ PerlIO *supplied_fp; } if (IoTYPE(io) && IoTYPE(io) != '|' && IoTYPE(io) != '-') { + dTHR; if (Fstat(PerlIO_fileno(fp),&statbuf) < 0) { (void)PerlIO_close(fp); goto say_false; @@ -297,8 +298,9 @@ PerlIO *supplied_fp; !statbuf.st_mode #endif ) { - Sock_size_t buflen = sizeof tokenbuf; - if (getsockname(PerlIO_fileno(fp), (struct sockaddr *)tokenbuf, + char tmpbuf[256]; + Sock_size_t buflen = sizeof tmpbuf; + if (getsockname(PerlIO_fileno(fp), (struct sockaddr *)tmpbuf, &buflen) >= 0 || errno != ENOTSOCK) IoTYPE(io) = 's'; /* some OS's return 0 on fstat()ed socket */ @@ -340,6 +342,7 @@ PerlIO *supplied_fp; #endif IoIFP(io) = fp; if (writing) { + dTHR; if (IoTYPE(io) == 's' || (IoTYPE(io) == '>' && S_ISCHR(statbuf.st_mode)) ) { if (!(IoOFP(io) = PerlIO_fdopen(PerlIO_fileno(fp),"w"))) { @@ -629,13 +629,14 @@ MAGIC* mg; char *strend = s + len; while (s < strend) { + char tmpbuf[256]; struct stat st; - s = delimcpy(tokenbuf, tokenbuf + sizeof tokenbuf, + s = delimcpy(tmpbuf, tmpbuf + sizeof tmpbuf, s, strend, ':', &i); s++; - if (i >= sizeof tokenbuf /* too long -- assume the worst */ - || *tokenbuf != '/' - || (Stat(tokenbuf, &st) == 0 && (st.st_mode & 2)) ) { + if (i >= sizeof tmpbuf /* too long -- assume the worst */ + || *tmpbuf != '/' + || (Stat(tmpbuf, &st) == 0 && (st.st_mode & 2)) ) { MgTAINTEDDIR_on(mg); return 0; } @@ -2205,6 +2205,7 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n"); #else /* !DOSUID */ if (euid != uid || egid != gid) { /* (suidperl doesn't exist, in fact) */ #ifndef SETUID_SCRIPTS_ARE_SECURE_NOW + dTHR; Fstat(PerlIO_fileno(rsfp),&statbuf); /* may be either wrapped or real suid */ if ((euid != uid && euid == statbuf.st_uid && statbuf.st_mode & S_ISUID) || @@ -178,7 +178,8 @@ PP(pp_backtick) fp = my_popen(tmps, "r"); if (fp) { if (gimme == G_VOID) { - while (PerlIO_read(fp, tokenbuf, sizeof tokenbuf) > 0) + char tmpbuf[256]; + while (PerlIO_read(fp, tmpbuf, sizeof tmpbuf) > 0) /*SUPPRESS 530*/ ; } @@ -965,7 +965,7 @@ register SV *sv; case SVt_NULL: sv_catpv(t, "UNDEF"); - return tokenbuf; + goto finish; case SVt_IV: sv_catpv(t, "IV"); break; @@ -1609,6 +1609,7 @@ STRLEN *lp; register char *s; int olderrno; SV *tsv; + char tmpbuf[64]; /* Must fit sprintf/Gconvert of longest IV/NV */ if (!sv) { *lp = 0; @@ -1621,13 +1622,13 @@ STRLEN *lp; return SvPVX(sv); } if (SvIOKp(sv)) { - (void)sprintf(tokenbuf,"%ld",(long)SvIVX(sv)); + (void)sprintf(tmpbuf,"%ld",(long)SvIVX(sv)); tsv = Nullsv; goto tokensave; } if (SvNOKp(sv)) { SET_NUMERIC_STANDARD(); - Gconvert(SvNVX(sv), DBL_DIG, 0, tokenbuf); + Gconvert(SvNVX(sv), DBL_DIG, 0, tmpbuf); tsv = Nullsv; goto tokensave; } @@ -1683,12 +1684,12 @@ STRLEN *lp; if (SvREADONLY(sv)) { if (SvNOKp(sv)) { SET_NUMERIC_STANDARD(); - Gconvert(SvNVX(sv), DBL_DIG, 0, tokenbuf); + Gconvert(SvNVX(sv), DBL_DIG, 0, tmpbuf); tsv = Nullsv; goto tokensave; } if (SvIOKp(sv)) { - (void)sprintf(tokenbuf,"%ld",(long)SvIVX(sv)); + (void)sprintf(tmpbuf,"%ld",(long)SvIVX(sv)); tsv = Nullsv; goto tokensave; } @@ -1753,7 +1754,7 @@ STRLEN *lp; tokensaveref: if (!tsv) - tsv = newSVpv(tokenbuf, 0); + tsv = newSVpv(tmpbuf, 0); sv_2mortal(tsv); *lp = SvCUR(tsv); return SvPVX(tsv); @@ -1768,8 +1769,8 @@ STRLEN *lp; len = SvCUR(tsv); } else { - t = tokenbuf; - len = strlen(tokenbuf); + t = tmpbuf; + len = strlen(tmpbuf); } #ifdef FIXNEGATIVEZERO if (len == 2 && t[0] == '-' && t[1] == '0') { @@ -115,8 +115,6 @@ struct thread { SV * TSv; XPV * TXpv; - char Tbuf[2048]; /* should be a global locked by a mutex */ - char Ttokenbuf[256]; /* should be a global locked by a mutex */ struct stat Tstatbuf; struct tms Ttimesbuf; @@ -225,6 +223,8 @@ typedef struct condpair { #undef curpad #undef Sv #undef Xpv +#undef statbuf +#undef timesbuf #undef top_env #undef runlevel #undef in_eval @@ -270,6 +270,8 @@ typedef struct condpair { #define curpad (thr->Tcurpad) #define Sv (thr->TSv) #define Xpv (thr->TXpv) +#define statbuf (thr->Tstatbuf) +#define timesbuf (thr->Ttimesbuf) #define defstash (thr->Tdefstash) #define curstash (thr->Tcurstash) |