summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c65
1 files changed, 40 insertions, 25 deletions
diff --git a/sv.c b/sv.c
index 224ba0accb..855f608b9c 100644
--- a/sv.c
+++ b/sv.c
@@ -1965,17 +1965,19 @@ register SV *sstr;
if (GvCVGEN(dstr) && GvCV(dstr) != (CV*)sref) {
SvREFCNT_dec(GvCV(dstr));
GvCV(dstr) = Nullcv;
- GvCVGEN(dstr) = 0;
+ GvCVGEN(dstr) = 0; /* Switch off cacheness. */
+ sub_generation++;
}
SAVESPTR(GvCV(dstr));
}
- else {
+ else
+ dref = (SV*)GvCV(dstr);
+ if (GvCV(dstr) != (CV*)sref) {
CV* cv = GvCV(dstr);
if (cv) {
- dref = (SV*)cv;
- if (sref != dref &&
- !GvCVGEN((GV*)dstr) &&
- (CvROOT(cv) || CvXSUB(cv)) ) {
+ if (!GvCVGEN((GV*)dstr) &&
+ (CvROOT(cv) || CvXSUB(cv)))
+ {
if (cv_const_sv(cv))
warn("Constant subroutine %s redefined",
GvENAME((GV*)dstr));
@@ -1983,9 +1985,14 @@ register SV *sstr;
warn("Subroutine %s redefined",
GvENAME((GV*)dstr));
}
+ if (SvPOK(cv) != SvPOK(sref)
+ || (SvPOK(cv)
+ && strNE(SvPVX(cv), SvPVX(sref)))) {
+ warn("Prototype mismatch: (%s) vs (%s)",
+ SvPOK(cv) ? SvPVX(cv) : "none",
+ SvPOK(sref) ? SvPVX(sref) : "none");
+ }
}
- }
- if (GvCV(dstr) != (CV*)sref) {
GvCV(dstr) = (CV*)sref;
GvCVGEN(dstr) = 0; /* Switch off cacheness. */
GvASSUMECV_on(dstr);
@@ -2429,7 +2436,7 @@ I32 namlen;
mg->mg_virtual = &vtbl_substr;
break;
case 'y':
- mg->mg_virtual = &vtbl_itervar;
+ mg->mg_virtual = &vtbl_defelem;
break;
case '*':
mg->mg_virtual = &vtbl_glob;
@@ -3088,11 +3095,11 @@ I32 append;
bp = (STDCHAR*)SvPVX(sv) + append; /* move these two too to registers */
ptr = (STDCHAR*)PerlIO_get_ptr(fp);
DEBUG_P(PerlIO_printf(Perl_debug_log,
- "Screamer: entering, ptr=%d, cnt=%d\n",ptr,cnt));
+ "Screamer: entering, ptr=%ld, cnt=%ld\n",(long)ptr,(long)cnt));
DEBUG_P(PerlIO_printf(Perl_debug_log,
- "Screamer: entering: FILE * thinks ptr=%d, cnt=%d, base=%d\n",
- PerlIO_get_ptr(fp), PerlIO_get_cnt(fp),
- PerlIO_has_base(fp) ? PerlIO_get_base(fp) : 0));
+ "Screamer: entering: FILE * thinks ptr=%ld, cnt=%ld, base=%ld\n",
+ (long)PerlIO_get_ptr(fp), (long)PerlIO_get_cnt(fp),
+ (long)(PerlIO_has_base(fp) ? PerlIO_get_base(fp) : 0)));
for (;;) {
screamer:
if (cnt > 0) {
@@ -3122,24 +3129,24 @@ I32 append;
}
DEBUG_P(PerlIO_printf(Perl_debug_log,
- "Screamer: going to getc, ptr=%d, cnt=%d\n",ptr,cnt));
+ "Screamer: going to getc, ptr=%ld, cnt=%ld\n",(long)ptr,(long)cnt));
PerlIO_set_ptrcnt(fp, ptr, cnt); /* deregisterize cnt and ptr */
DEBUG_P(PerlIO_printf(Perl_debug_log,
- "Screamer: pre: FILE * thinks ptr=%d, cnt=%d, base=%d\n",
- PerlIO_get_ptr(fp), PerlIO_get_cnt(fp),
- PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0));
+ "Screamer: pre: FILE * thinks ptr=%ld, cnt=%ld, base=%ld\n",
+ (long)PerlIO_get_ptr(fp), (long)PerlIO_get_cnt(fp),
+ (long)(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0)));
/* This used to call 'filbuf' in stdio form, but as that behaves like
getc when cnt <= 0 we use PerlIO_getc here to avoid introducing
another abstraction. */
i = PerlIO_getc(fp); /* get more characters */
DEBUG_P(PerlIO_printf(Perl_debug_log,
- "Screamer: post: FILE * thinks ptr=%d, cnt=%d, base=%d\n",
- PerlIO_get_ptr(fp), PerlIO_get_cnt(fp),
- PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0));
+ "Screamer: post: FILE * thinks ptr=%ld, cnt=%ld, base=%ld\n",
+ (long)PerlIO_get_ptr(fp), (long)PerlIO_get_cnt(fp),
+ (long)(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0)));
cnt = PerlIO_get_cnt(fp);
ptr = (STDCHAR*)PerlIO_get_ptr(fp); /* reregisterize cnt and ptr */
DEBUG_P(PerlIO_printf(Perl_debug_log,
- "Screamer: after getc, ptr=%d, cnt=%d\n",ptr,cnt));
+ "Screamer: after getc, ptr=%ld, cnt=%ld\n",(long)ptr,(long)cnt));
if (i == EOF) /* all done for ever? */
goto thats_really_all_folks;
@@ -3163,12 +3170,12 @@ thats_really_all_folks:
if (shortbuffered)
cnt += shortbuffered;
DEBUG_P(PerlIO_printf(Perl_debug_log,
- "Screamer: quitting, ptr=%d, cnt=%d\n",ptr,cnt));
+ "Screamer: quitting, ptr=%ld, cnt=%ld\n",(long)ptr,(long)cnt));
PerlIO_set_ptrcnt(fp, ptr, cnt); /* put these back or we're in trouble */
DEBUG_P(PerlIO_printf(Perl_debug_log,
- "Screamer: end: FILE * thinks ptr=%d, cnt=%d, base=%d\n",
- PerlIO_get_ptr(fp), PerlIO_get_cnt(fp),
- PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0));
+ "Screamer: end: FILE * thinks ptr=%ld, cnt=%ld, base=%ld\n",
+ (long)PerlIO_get_ptr(fp), (long)PerlIO_get_cnt(fp),
+ (long)(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0)));
*bp = '\0';
SvCUR_set(sv, bp - (STDCHAR*)SvPVX(sv)); /* set length */
DEBUG_P(PerlIO_printf(Perl_debug_log,
@@ -3804,6 +3811,10 @@ int
sv_isobject(sv)
SV *sv;
{
+ if (!sv)
+ return 0;
+ if (SvGMAGICAL(sv))
+ mg_get(sv);
if (!SvROK(sv))
return 0;
sv = (SV*)SvRV(sv);
@@ -3817,6 +3828,10 @@ sv_isa(sv, name)
SV *sv;
char *name;
{
+ if (!sv)
+ return 0;
+ if (SvGMAGICAL(sv))
+ mg_get(sv);
if (!SvROK(sv))
return 0;
sv = (SV*)SvRV(sv);