diff options
author | Karl Williamson <khw@cpan.org> | 2014-10-04 11:13:45 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2014-10-07 08:51:10 -0600 |
commit | 97651d61d67d90d9b6e1cbef032da8bee3f503cc (patch) | |
tree | e22a4479efa27bc5cdd47d5b29dba7c0fa6876ae /toke.c | |
parent | 85fba779aa33088791f9baea8a0627082b44470c (diff) | |
download | perl-97651d61d67d90d9b6e1cbef032da8bee3f503cc.tar.gz |
toke.c: Extract into a named string constant
This moves a literal double-quoted string into a const variable, so that
it only need be written out once, and its size can be compiler-computed
and used as another const variable. Hence, mnemonics are used instead
of bare numbers.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -3363,13 +3363,18 @@ S_scan_const(pTHX_ char *start) * through the string. Each character takes up * 2 hex digits plus either a trailing dot or * the "}" */ + const char initial_text[] = "\\N{U+"; + const STRLEN initial_len = sizeof(initial_text) + - 1; d = off + SvGROW(sv, off + 3 * len - + 6 /* For the "\N{U+", and - trailing NUL */ + + /* +1 for trailing NUL */ + + initial_len + 1 + + (STRLEN)(send - e)); - Copy("\\N{U+", d, 5, char); - d += 5; + Copy(initial_text, d, initial_len, char); + d += initial_len; while (str < str_end) { char hex_string[4]; int len = |