}
}
BmRARE(sv) = s[rarest];
- BmPREVIOUS(sv) = rarest;
+ BmPREVIOUS(sv) = (U16)rarest;
BmUSEFUL(sv) = 100; /* Initial value */
if (flags & FBMcf_TAIL)
SvTAIL_on(sv);
register STRLEN littlelen = l;
register I32 multiline = flags & FBMrf_MULTILINE;
- if (bigend - big < littlelen) {
+ if ((STRLEN)(bigend - big) < littlelen) {
if ( SvTAIL(littlestr)
- && (bigend - big == littlelen - 1)
+ && ((STRLEN)(bigend - big) == littlelen - 1)
&& (littlelen == 1
|| (*big == *little &&
memEQ((char *)big, (char *)little, littlelen - 1))))
register unsigned char *table = little + littlelen + FBM_TABLE_OFFSET;
register unsigned char *oldlittle;
- if (littlelen > bigend - big)
+ if (littlelen > (STRLEN)(bigend - big))
return Nullch;
--littlelen; /* Last char found by table lookup */
/* start_shift, end_shift are positive quantities which give offsets
of ends of some substring of bigstr.
- If `last' we want the last occurence.
+ If `last' we want the last occurrence.
old_posp is the way of communication between consequent calls if
the next call needs to find the .
The initial *old_posp should be -1.
bool line_mode = (RsSIMPLE(PL_rs) &&
SvCUR(PL_rs) == 1 && *SvPVX(PL_rs) == '\n');
Perl_sv_catpvf(aTHX_ sv, ", <%s> %s %"IVdf,
- PL_last_in_gv == PL_argvgv ? "" : GvNAME(PL_last_in_gv),
- line_mode ? "line" : "chunk",
- (IV)IoLINES(GvIOp(PL_last_in_gv)));
+ PL_last_in_gv == PL_argvgv ?
+ "" : GvNAME(PL_last_in_gv),
+ line_mode ? "line" : "chunk",
+ (IV)IoLINES(GvIOp(PL_last_in_gv)));
}
#ifdef USE_5005THREADS
if (thr->tid)
void
Perl_my_setenv(pTHX_ char *nam, char *val)
{
+#ifdef USE_ITHREADS
+ /* only parent thread can modify process environment */
+ if (PL_curinterp == aTHX)
+#endif
+ {
#ifndef PERL_USE_SAFE_PUTENV
/* most putenv()s leak, so we manipulate environ directly */
register I32 i=setenv_getix(nam); /* where does it go? */
(void)putenv(new_env);
# endif /* __CYGWIN__ */
#endif /* PERL_USE_SAFE_PUTENV */
+ }
}
#else /* WIN32 || NETWARE */
while ((pid = PerlProc_fork()) < 0) {
if (errno != EAGAIN) {
PerlLIO_close(p[This]);
+ PerlLIO_close(p[that]);
if (did_pipes) {
PerlLIO_close(pp[0]);
PerlLIO_close(pp[1]);
#undef THAT
#define THIS that
#define THAT This
- PerlLIO_close(p[THAT]);
if (did_pipes) {
PerlLIO_close(pp[0]);
#if defined(HAS_FCNTL) && defined(F_SETFD)
if (p[THIS] != (*mode == 'r')) {
PerlLIO_dup2(p[THIS], *mode == 'r');
PerlLIO_close(p[THIS]);
+ if (p[THAT] != (*mode == 'r')) /* if dup2() didn't close it */
+ PerlLIO_close(p[THAT]);
}
+ else
+ PerlLIO_close(p[THAT]);
#ifndef OS2
if (doexec) {
#if !defined(HAS_FCNTL) || !defined(F_SETFD)
#undef THIS
#undef THAT
}
- do_execfree(); /* free any memory malloced by child on fork */
- PerlLIO_close(p[that]);
+ do_execfree(); /* free any memory malloced by child on vfork */
if (did_pipes)
PerlLIO_close(pp[1]);
if (p[that] < p[This]) {
PerlLIO_close(p[This]);
p[This] = p[that];
}
+ else
+ PerlLIO_close(p[that]);
+
LOCK_FDPID_MUTEX;
sv = *av_fetch(PL_fdpid,p[This],TRUE);
UNLOCK_FDPID_MUTEX;
Perl_dump_fds(pTHX_ char *s)
{
int fd;
- struct stat tmpstatbuf;
+ Stat_t tmpstatbuf;
PerlIO_printf(Perl_debug_log,"%s", s);
for (fd = 0; fd < 32; fd++) {
hv_iterinit(PL_pidstatus);
if ((entry = hv_iternext(PL_pidstatus))) {
+ SV *sv;
+ char spid[TYPE_CHARS(int)];
+
pid = atoi(hv_iterkey(entry,(I32*)statusp));
sv = hv_iterval(PL_pidstatus,entry);
*statusp = SvIVX(sv);
{
char *fa = strrchr(a,'/');
char *fb = strrchr(b,'/');
- struct stat tmpstatbuf1;
- struct stat tmpstatbuf2;
+ Stat_t tmpstatbuf1;
+ Stat_t tmpstatbuf2;
SV *tmpsv = sv_newmortal();
if (fa)
SvCUR_set(sv, sizeof(struct perl_thread));
thr = (Thread) SvPVX(sv);
#ifdef DEBUGGING
- memset(thr, 0xab, sizeof(struct perl_thread));
+ Poison(thr, 1, struct perl_thread);
PL_markstack = 0;
PL_scopestack = 0;
PL_savestack = 0;
return PerlIO_flush(NULL);
#else
# if defined(HAS__FWALK)
+ extern int fflush(FILE *);
/* undocumented, unprototyped, but very useful BSDism */
extern void _fwalk(int (*)(FILE *));
_fwalk(&fflush);
}
if (gv && isGV(gv)) {
- SV *sv = sv_newmortal();
- gv_efullname4(sv, gv, Nullch, FALSE);
- name = SvPVX(sv);
+ name = GvENAME(gv);
}
if (op == OP_phoney_OUTPUT_ONLY || op == OP_phoney_INPUT_ONLY) {
#else
- struct stat statbuf;
+ Stat_t statbuf;
int orig_cdev, orig_cino, cdev, cino, odev, oino, tdev, tino;
int namelen, pathlen=0;
DIR *dir;
}
#endif /* EMULATE_SOCKETPAIR_UDP */
-#if !defined(HAS_SOCKETPAIR) && defined(HAS_SOCKET) && defined(AF_INET) && defined(PF_INET)
+#if !defined(HAS_SOCKETPAIR) && defined(HAS_SOCKET) && defined(AF_INET) && defined(PF_INET)
int
Perl_my_socketpair (int family, int type, int protocol, int fd[2]) {
/* Stevens says that family must be AF_LOCAL, protocol 0.