From: Andy Lester Date: Thu, 27 Apr 2006 00:32:15 +0000 (-0500) Subject: Removing unused context X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=721e86b6b33d80a7a725210c34b4f10a4d35bdaf;p=p5sagit%2Fp5-mst-13.2.git Removing unused context Message-ID: <20060427053215.GA31445@petdance.com> p4raw-id: //depot/perl@27976 --- diff --git a/embed.fnc b/embed.fnc index 5d3b858..55f65fb 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1368,9 +1368,9 @@ s |int |sv_2iuv_non_preserve |NN SV *sv|I32 numtype # 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 \ diff --git a/embed.h b/embed.h index 9e8c6ed..8476916 100644 --- a/embed.h +++ b/embed.h @@ -3548,8 +3548,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) diff --git a/proto.h b/proto.h index 8a5b92a..bd5d285 100644 --- a/proto.h +++ b/proto.h @@ -3737,13 +3737,13 @@ STATIC I32 S_expect_number(pTHX_ char** pattern) __attribute__nonnull__(pTHX_1); # -STATIC STRLEN S_sv_pos_u2b_forwards(pTHX_ const U8 *const start, const U8 *const send, STRLEN uoffset) - __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2); +STATIC STRLEN S_sv_pos_u2b_forwards(const U8 *const start, const U8 *const send, STRLEN uoffset) + __attribute__nonnull__(1) + __attribute__nonnull__(2); -STATIC STRLEN S_sv_pos_u2b_midway(pTHX_ const U8 *const start, const U8 *send, STRLEN uoffset, STRLEN uend) - __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2); +STATIC STRLEN S_sv_pos_u2b_midway(const U8 *const start, const U8 *send, STRLEN uoffset, STRLEN uend) + __attribute__nonnull__(1) + __attribute__nonnull__(2); 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) __attribute__nonnull__(pTHX_1) diff --git a/sv.c b/sv.c index 71e871a..30b118b 100644 --- a/sv.c +++ b/sv.c @@ -5366,13 +5366,11 @@ Perl_sv_len_utf8(pTHX_ register SV *sv) /* 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) { @@ -5387,7 +5385,7 @@ S_sv_pos_u2b_forwards(pTHX_ const U8 *const start, const U8 *const send, 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; @@ -5395,7 +5393,7 @@ S_sv_pos_u2b_midway(pTHX_ const U8 *const start, const U8 *send, /* 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--) { @@ -5446,12 +5444,12 @@ S_sv_pos_u2b_cached(pTHX_ SV *sv, MAGIC **mgp, const U8 *const start, 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); } } @@ -5464,13 +5462,13 @@ S_sv_pos_u2b_cached(pTHX_ SV *sv, MAGIC **mgp, const U8 *const start, } 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); @@ -5482,7 +5480,7 @@ S_sv_pos_u2b_cached(pTHX_ SV *sv, MAGIC **mgp, const U8 *const start, /* 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; @@ -5491,7 +5489,7 @@ S_sv_pos_u2b_cached(pTHX_ SV *sv, MAGIC **mgp, const U8 *const start, 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) { @@ -5546,16 +5544,16 @@ Perl_sv_pos_u2b(pTHX_ register SV *sv, I32* offsetp, I32* lenp) 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;