diff options
author | David Mitchell <davem@iabyn.com> | 2011-05-29 12:41:42 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2011-05-29 20:21:53 +0100 |
commit | a1137ee5607c4873f12c9cc5e710d25e9df62f26 (patch) | |
tree | 00f2738279b245f4705761bb92381636cb899d9b /pp_ctl.c | |
parent | 75645721ec0bf7e29d35fd08c19b30c0ac877f1c (diff) | |
download | perl-a1137ee5607c4873f12c9cc5e710d25e9df62f26.tar.gz |
pp_formline: don't set itemsize in FF_LINEGLOB
This var is used to enable padding or truncating of output items.
FF_LINESNGL/FF_LINEGLOB do their own version of this, so there's
no need to set it there.
Or to put it another way, we don't expect a FF_LINESNGL or FF_LINEGLOB op
to be followed immediately by FF_SPACE, FF_HALFSPACE, FF_ITEM nor FF_MORE.
Not calculating it makes the code simpler and eases the path to merging
the appending code.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 19 |
1 files changed, 3 insertions, 16 deletions
@@ -895,11 +895,10 @@ PP(pp_formline) const char *const send = s + len; item_is_utf8 = DO_UTF8(sv); - itemsize = len; - if (!itemsize) + if (!len) break; gotsome = TRUE; - chophere = s + itemsize; + chophere = s + len; source = (U8 *) s; to_copy = len; while (s < send) { @@ -910,7 +909,6 @@ PP(pp_formline) break; } else { if (s == send) { - itemsize--; to_copy--; } else lines++; @@ -949,19 +947,8 @@ PP(pp_formline) Copy(source, t, to_copy, char); t += to_copy; SvCUR_set(PL_formtarget, SvCUR(PL_formtarget) + to_copy); - if (item_is_utf8) { - if (SvGMAGICAL(sv)) { - /* Mustn't call sv_pos_b2u() as it does a second - mg_get(). Is this a bug? Do we need a _flags() - variant? */ - itemsize = utf8_length(source, source + itemsize); - } else { - sv_pos_b2u(sv, &itemsize); - } - assert(!tmp); - } else if (tmp) { + if (tmp) Safefree(tmp); - } break; } |