Change 29963 by [EMAIL PROTECTED] on 2007/01/24 23:24:03
Integrate:
[ 27976]
Subject: [PATCH] Removing unused context
From: [EMAIL PROTECTED] (Andy Lester)
Date: Thu, 27 Apr 2006 00:32:15 -0500
Message-ID: <[EMAIL PROTECTED]>
[ 27992]
Subject: [PATCH] Removing another context parm
From: [EMAIL PROTECTED] (Andy Lester)
Date: Thu, 27 Apr 2006 10:31:56 -0500
Message-ID: <[EMAIL PROTECTED]>
[ 28020]
Coverity disliked us passing a negative length to vsnprintf().
[ 28023]
remove a compiler warning by making HOPBACKc only hop *back*
[ 28032]
Replace a STRLEN no_len; with a _nolen macro call.
[ 28041]
Reverting context removal from change #27992. This should
clear up threaded builds on Win32 and VMS.
[ 28055]
Subject: [PATCH] toke.c: function pointer to data pointer
From: Jarkko Hietaniemi <[EMAIL PROTECTED]>
Date: Tue, 2 May 2006 08:25:55 +0300 (EEST)
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
... //depot/maint-5.8/perl/embed.fnc#186 integrate
... //depot/maint-5.8/perl/embed.h#139 integrate
... //depot/maint-5.8/perl/perlio.c#90 integrate
... //depot/maint-5.8/perl/pp_ctl.c#156 integrate
... //depot/maint-5.8/perl/pp_pack.c#47 integrate
... //depot/maint-5.8/perl/proto.h#175 edit
... //depot/maint-5.8/perl/regexec.c#77 integrate
... //depot/maint-5.8/perl/sv.c#314 integrate
... //depot/maint-5.8/perl/toke.c#146 integrate
Differences ...
==== //depot/maint-5.8/perl/embed.fnc#186 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#185~29958~ 2007-01-24 11:49:21.000000000 -0800
+++ perl/embed.fnc 2007-01-24 15:24:03.000000000 -0800
@@ -1308,9 +1308,9 @@
# endif
sR |I32 |expect_number |NN char** pattern
#
-s |STRLEN |sv_pos_u2b_forwards|NN const U8 *const start \
+sn |STRLEN |sv_pos_u2b_forwards|NN const U8 *const start \
|NN const U8 *const send|STRLEN uoffset
-s |STRLEN |sv_pos_u2b_midway|NN const U8 *const start \
+sn |STRLEN |sv_pos_u2b_midway|NN const U8 *const start \
|NN const U8 *send|STRLEN uoffset|STRLEN uend
s |STRLEN |sv_pos_u2b_cached|NN SV *sv|NN MAGIC **mgp \
|NN const U8 *const start|NN const U8 *const send \
==== //depot/maint-5.8/perl/embed.h#139 (text+w) ====
Index: perl/embed.h
--- perl/embed.h#138~29955~ 2007-01-24 10:58:36.000000000 -0800
+++ perl/embed.h 2007-01-24 15:24:03.000000000 -0800
@@ -3423,8 +3423,8 @@
#define expect_number(a) S_expect_number(aTHX_ a)
#endif
#ifdef PERL_CORE
-#define sv_pos_u2b_forwards(a,b,c) S_sv_pos_u2b_forwards(aTHX_ a,b,c)
-#define sv_pos_u2b_midway(a,b,c,d) S_sv_pos_u2b_midway(aTHX_ a,b,c,d)
+#define sv_pos_u2b_forwards S_sv_pos_u2b_forwards
+#define sv_pos_u2b_midway S_sv_pos_u2b_midway
#define sv_pos_u2b_cached(a,b,c,d,e,f,g) S_sv_pos_u2b_cached(aTHX_
a,b,c,d,e,f,g)
#define utf8_mg_pos_cache_update(a,b,c,d,e)
S_utf8_mg_pos_cache_update(aTHX_ a,b,c,d,e)
#define sv_pos_b2u_forwards(a,b) S_sv_pos_b2u_forwards(aTHX_ a,b)
==== //depot/maint-5.8/perl/perlio.c#90 (text) ====
Index: perl/perlio.c
--- perl/perlio.c#89~29962~ 2007-01-24 14:51:14.000000000 -0800
+++ perl/perlio.c 2007-01-24 15:24:03.000000000 -0800
@@ -5094,7 +5094,7 @@
PerlIO_vsprintf(char *s, int n, const char *fmt, va_list ap)
{
#ifdef USE_VSNPRINTF
- const int val = vsnprintf(s, n, fmt, ap);
+ const int val = vsnprintf(s, n > 0 ? n : 0, fmt, ap);
#else
const int val = vsprintf(s, fmt, ap);
#endif /* #ifdef USE_VSNPRINTF */
==== //depot/maint-5.8/perl/pp_ctl.c#156 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#155~29962~ 2007-01-24 14:51:14.000000000 -0800
+++ perl/pp_ctl.c 2007-01-24 15:24:03.000000000 -0800
@@ -2937,6 +2937,7 @@
{
Stat_t st;
const int st_rc = PerlLIO_stat(name, &st);
+
if (st_rc < 0 || S_ISDIR(st.st_mode) || S_ISBLK(st.st_mode)) {
return NULL;
}
@@ -3127,7 +3128,7 @@
{
namesv = newSV(0);
for (i = 0; i <= AvFILL(ar); i++) {
- SV *dirsv = *av_fetch(ar, i, TRUE);
+ SV * const dirsv = *av_fetch(ar, i, TRUE);
if (SvROK(dirsv)) {
int count;
@@ -3180,7 +3181,7 @@
}
if (SvTYPE(arg) == SVt_PVGV) {
- IO *io = GvIO((GV *)arg);
+ IO * const io = GvIO((GV *)arg);
++filter_has_file;
==== //depot/maint-5.8/perl/pp_pack.c#47 (text) ====
Index: perl/pp_pack.c
--- perl/pp_pack.c#46~29807~ 2007-01-14 05:09:22.000000000 -0800
+++ perl/pp_pack.c 2007-01-24 15:24:03.000000000 -0800
@@ -2482,14 +2482,13 @@
Perl_packlist(pTHX_ SV *cat, char *pat, char *patend, register SV **beglist,
SV **endlist)
{
- STRLEN no_len;
tempsym_t sym;
TEMPSYM_INIT(&sym, pat, patend, FLAG_PACK);
/* We're going to do changes through SvPVX(cat). Make sure it's valid.
Also make sure any UTF8 flag is loaded */
- SvPV_force(cat, no_len);
+ SvPV_force_nolen(cat);
if (DO_UTF8(cat)) sym.flags |= FLAG_PARSE_UTF8 | FLAG_DO_UTF8;
(void)pack_rec( cat, &sym, beglist, endlist );
==== //depot/maint-5.8/perl/proto.h#175 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#174~29958~ 2007-01-24 11:49:21.000000000 -0800
+++ perl/proto.h 2007-01-24 15:24:03.000000000 -0800
@@ -1902,8 +1902,8 @@
__attribute__warn_unused_result__;
#
-STATIC STRLEN S_sv_pos_u2b_forwards(pTHX_ const U8 *const start, const U8
*const send, STRLEN uoffset);
-STATIC STRLEN S_sv_pos_u2b_midway(pTHX_ const U8 *const start, const U8
*send, STRLEN uoffset, STRLEN uend);
+STATIC STRLEN S_sv_pos_u2b_forwards(const U8 *const start, const U8 *const
send, STRLEN uoffset);
+STATIC STRLEN S_sv_pos_u2b_midway(const U8 *const start, const U8 *send,
STRLEN uoffset, STRLEN uend);
STATIC STRLEN S_sv_pos_u2b_cached(pTHX_ SV *sv, MAGIC **mgp, const U8 *const
start, const U8 *const send, STRLEN uoffset, STRLEN uoffset0, STRLEN boffset0);
STATIC void S_utf8_mg_pos_cache_update(pTHX_ SV *sv, MAGIC **mgp, STRLEN
byte, STRLEN utf8, STRLEN blen);
STATIC STRLEN S_sv_pos_b2u_forwards(pTHX_ const U8 *s, const U8 *const
target);
==== //depot/maint-5.8/perl/regexec.c#77 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#76~29962~ 2007-01-24 14:51:14.000000000 -0800
+++ perl/regexec.c 2007-01-24 15:24:03.000000000 -0800
@@ -121,7 +121,7 @@
: (U8*)(pos + off)))
#define HOPBACKc(pos, off) ((char*) \
((PL_reg_match_utf8) \
- ? reghopmaybe3((U8*)pos, -off, ((U8*)(off < 0 ? PL_regeol : PL_bostr)))
\
+ ? reghopmaybe3((U8*)pos, -off, (U8*)PL_bostr) \
: (pos - off >= PL_bostr) \
? (U8*)(pos - off) \
: (U8*)NULL) \
==== //depot/maint-5.8/perl/sv.c#314 (text) ====
Index: perl/sv.c
--- perl/sv.c#313~29962~ 2007-01-24 14:51:14.000000000 -0800
+++ perl/sv.c 2007-01-24 15:24:03.000000000 -0800
@@ -4815,13 +4815,11 @@
/* Walk forwards to find the byte corresponding to the passed in UTF-8
offset. */
static STRLEN
-S_sv_pos_u2b_forwards(pTHX_ const U8 *const start, const U8 *const send,
+S_sv_pos_u2b_forwards(const U8 *const start, const U8 *const send,
STRLEN uoffset)
{
const U8 *s = start;
- PERL_UNUSED_CONTEXT;
-
while (s < send && uoffset--)
s += UTF8SKIP(s);
if (s > send) {
@@ -4836,7 +4834,7 @@
whether to walk forwards or backwards to find the byte corresponding to
the passed in UTF-8 offset. */
static STRLEN
-S_sv_pos_u2b_midway(pTHX_ const U8 *const start, const U8 *send,
+S_sv_pos_u2b_midway(const U8 *const start, const U8 *send,
STRLEN uoffset, STRLEN uend)
{
STRLEN backw = uend - uoffset;
@@ -4844,7 +4842,7 @@
/* The assumption is that going forwards is twice the speed of going
forward (that's where the 2 * backw comes from).
(The real figure of course depends on the UTF-8 data.) */
- return S_sv_pos_u2b_forwards(aTHX_ start, send, uoffset);
+ return sv_pos_u2b_forwards(start, send, uoffset);
}
while (backw--) {
@@ -4895,12 +4893,12 @@
if ((*mgp)->mg_len != -1) {
/* And we know the end too. */
boffset = boffset0
- + S_sv_pos_u2b_midway(aTHX_ start + boffset0, send,
+ + sv_pos_u2b_midway(start + boffset0, send,
uoffset - uoffset0,
(*mgp)->mg_len - uoffset0);
} else {
boffset = boffset0
- + S_sv_pos_u2b_forwards(aTHX_ start + boffset0,
+ + sv_pos_u2b_forwards(start + boffset0,
send, uoffset - uoffset0);
}
}
@@ -4913,13 +4911,13 @@
}
boffset = boffset0
- + S_sv_pos_u2b_midway(aTHX_ start + boffset0,
+ + sv_pos_u2b_midway(start + boffset0,
start + cache[1],
uoffset - uoffset0,
cache[0] - uoffset0);
} else {
boffset = boffset0
- + S_sv_pos_u2b_midway(aTHX_ start + boffset0,
+ + sv_pos_u2b_midway(start + boffset0,
start + cache[3],
uoffset - uoffset0,
cache[2] - uoffset0);
@@ -4931,7 +4929,7 @@
/* In fact, offset0 is either 0, or less than offset, so don't
need to worry about the other possibility. */
boffset = boffset0
- + S_sv_pos_u2b_midway(aTHX_ start + boffset0, send,
+ + sv_pos_u2b_midway(start + boffset0, send,
uoffset - uoffset0,
(*mgp)->mg_len - uoffset0);
found = TRUE;
@@ -4940,7 +4938,7 @@
if (!found || PL_utf8cache < 0) {
const STRLEN real_boffset
- = boffset0 + S_sv_pos_u2b_forwards(aTHX_ start + boffset0,
+ = boffset0 + sv_pos_u2b_forwards(start + boffset0,
send, uoffset - uoffset0);
if (found && PL_utf8cache < 0) {
@@ -4995,16 +4993,16 @@
STRLEN uoffset = (STRLEN) *offsetp;
const U8 * const send = start + len;
MAGIC *mg = NULL;
- STRLEN boffset = S_sv_pos_u2b_cached(aTHX_ sv, &mg, start, send,
+ const STRLEN boffset = sv_pos_u2b_cached(sv, &mg, start, send,
uoffset, 0, 0);
*offsetp = (I32) boffset;
if (lenp) {
/* Convert the relative offset to absolute. */
- STRLEN uoffset2 = uoffset + (STRLEN) *lenp;
- STRLEN boffset2
- = S_sv_pos_u2b_cached(aTHX_ sv, &mg, start, send, uoffset2,
+ const STRLEN uoffset2 = uoffset + (STRLEN) *lenp;
+ const STRLEN boffset2
+ = sv_pos_u2b_cached(sv, &mg, start, send, uoffset2,
uoffset, boffset) - boffset;
*lenp = boffset2;
}
==== //depot/maint-5.8/perl/toke.c#146 (text) ====
Index: perl/toke.c
--- perl/toke.c#145~29962~ 2007-01-24 14:51:14.000000000 -0800
+++ perl/toke.c 2007-01-24 15:24:03.000000000 -0800
@@ -2218,7 +2218,8 @@
IoANY(datasv) = FPTR2DPTR(void *, funcp); /* stash funcp into spare field
*/
IoFLAGS(datasv) |= IOf_FAKE_DIRP;
DEBUG_P(PerlIO_printf(Perl_debug_log, "filter_add func %p (%s)\n",
- IoANY(datasv), SvPV_nolen(datasv)));
+ FPTR2DPTR(void *, IoANY(datasv)),
+ SvPV_nolen(datasv)));
av_unshift(PL_rsfp_filters, 1);
av_store(PL_rsfp_filters, 0, datasv) ;
return(datasv);
@@ -2232,7 +2233,8 @@
SV *datasv;
#ifdef DEBUGGING
- DEBUG_P(PerlIO_printf(Perl_debug_log, "filter_del func %p",
FPTR2DPTR(XPVIO *, funcp)));
+ DEBUG_P(PerlIO_printf(Perl_debug_log, "filter_del func %p",
+ FPTR2DPTR(void*, funcp)));
#endif
if (!PL_rsfp_filters || AvFILLp(PL_rsfp_filters)<0)
return;
@@ -11013,7 +11015,8 @@
const I32 count = FILTER_READ(idx+1, sv, maxlen);
DEBUG_P(PerlIO_printf(Perl_debug_log,
"utf16_textfilter(%p): %d %d (%d)\n",
- utf16_textfilter, idx, maxlen, (int) count));
+ FPTR2DPTR(void *, utf16_textfilter),
+ idx, maxlen, (int) count));
if (count) {
U8* tmps;
I32 newlen;
@@ -11034,7 +11037,8 @@
const I32 count = FILTER_READ(idx+1, sv, maxlen);
DEBUG_P(PerlIO_printf(Perl_debug_log,
"utf16rev_textfilter(%p): %d %d (%d)\n",
- utf16rev_textfilter, idx, maxlen, (int) count));
+ FPTR2DPTR(void *, utf16rev_textfilter),
+ idx, maxlen, (int) count));
if (count) {
U8* tmps;
I32 newlen;
End of Patch.