pp.c pp_pack.c: Use macro instead of function
authorKarl Williamson <public@khwilliamson.com>
Thu, 6 Dec 2012 18:31:19 +0000 (11:31 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sun, 9 Dec 2012 16:47:18 +0000 (09:47 -0700)
This converts to use is_SPACE_utf8() instead of the (soon to be
deprecated) is_utf8_space().  The macro is faster, avoiding the function
call completely, so the performance need to make a special case for a SPACE
character is gone.

pp.c
pp_pack.c

diff --git a/pp.c b/pp.c
index 2eb5bc1..33943e4 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -5380,7 +5380,7 @@ PP(pp_split)
     orig = s;
     if (skipwhite) {
        if (do_utf8) {
-           while (*s == ' ' || is_utf8_space((U8*)s))
+           while (isSPACE_utf8(s))
                s += UTF8SKIP(s);
        }
        else if (get_regex_charset(RX_EXTFLAGS(rx)) == REGEX_LOCALE_CHARSET) {
@@ -5405,9 +5405,9 @@ PP(pp_split)
            m = s;
            /* this one uses 'm' and is a negative test */
            if (do_utf8) {
-               while (m < strend && !( *m == ' ' || is_utf8_space((U8*)m) )) {
+               while (m < strend && ! isSPACE_utf8(m) ) {
                    const int t = UTF8SKIP(m);
-                   /* is_utf8_space returns FALSE for malform utf8 */
+                   /* isSPACE_utf8 returns FALSE for malform utf8 */
                    if (strend - m < t)
                        m = strend;
                    else
@@ -5444,7 +5444,7 @@ PP(pp_split)
 
            /* this one uses 's' and is a positive test */
            if (do_utf8) {
-               while (s < strend && ( *s == ' ' || is_utf8_space((U8*)s) ))
+               while (s < strend && isSPACE_utf8(s) )
                    s +=  UTF8SKIP(s);
            }
            else if (get_regex_charset(RX_EXTFLAGS(rx)) == REGEX_LOCALE_CHARSET) {
index a2a5c68..321a47d 100644 (file)
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -1470,7 +1470,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, const char *s, const char *strbeg, const c
                if (utf8 && (symptr->flags & FLAG_WAS_UTF8)) {
                    for (ptr = s+len-1; ptr >= s; ptr--)
                        if (*ptr != 0 && !UTF8_IS_CONTINUATION(*ptr) &&
-                           !is_utf8_space((U8 *) ptr)) break;
+                           !isSPACE_utf8(ptr)) break;
                    if (ptr >= s) ptr += UTF8SKIP(ptr);
                    else ptr++;
                    if (ptr > s+len)