From a21514029e93c52f6540cea23d5c3cc2b0e890c6 Mon Sep 17 00:00:00 2001
From: Martin Nilsson <nilsson@opera.com>
Date: Sun, 16 Feb 2014 22:03:46 +0100
Subject: [PATCH] Move SPACECASE8 into whitespace.h

---
 bin/getwhitespace.sh |  4 ++++
 src/builtin.cmod     | 13 +------------
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/bin/getwhitespace.sh b/bin/getwhitespace.sh
index 26799d6db9..213b16f5ce 100755
--- a/bin/getwhitespace.sh
+++ b/bin/getwhitespace.sh
@@ -2,6 +2,10 @@
 
 echo "/* File generated on `date`
 by getwhitespace <UnicodeData.txt */
+
+#define SPACECASE8							\\
+       case ' ':case '\\\\t':case '\\\\r':case '\\\\n':case '\\\\v':case '\\\\f':	\\
+       case 0x85:case 0xa0:
 "
 
 echo '#define SPACECASE16	SPACECASE8 \'
diff --git a/src/builtin.cmod b/src/builtin.cmod
index 427ebe8f58..8855de603f 100644
--- a/src/builtin.cmod
+++ b/src/builtin.cmod
@@ -31,6 +31,7 @@
 #include "block_allocator.h"
 #include "pikecode.h"
 #include "opcodes.h"
+#include "whitespace.h"
 
 #include <ctype.h>
 #include <errno.h>
@@ -1527,10 +1528,6 @@ PIKEFUN string string_normalize_space (string s, string|void whitespace)
     if(bshift == shift)
       sb.known_shift = bshift;
   }
-#define SPACECASE8							\
-       case ' ':case '\t':case '\r':case '\n':case '\v':case '\f':	\
-       case 0x85:case 0xa0:
-#include "whitespace.h"
 
   switch (shift) {
 #define NORMALISE_TIGHT_LOOP(TYPE,CASE)					\
@@ -1595,8 +1592,6 @@ skip##TYPE:;								\
     case 1: NORMALISE_TIGHT_LOOP (p_wchar1,SPACECASE16); break;
     case 2: NORMALISE_TIGHT_LOOP (p_wchar2,SPACECASE16); break;
 #undef NORMALISE_TIGHT_LOOP
-#undef SPACECASE8
-#undef SPACECASE16
   }
   if (wstemp)
     free(wstemp);
@@ -1620,10 +1615,6 @@ PIKEFUN string string_trim_all_whites (string s)
   ptrdiff_t start = 0, end = s->len;
   int chr;
   switch (s->size_shift) {
-#define SPACECASE8							\
-       case ' ':case '\t':case '\r':case '\n':case '\v':case '\f':	\
-       case 0x85:case 0xa0:
-#include "whitespace.h"
 
 #define DO_IT(TYPE,CASE)						\
     {									\
@@ -1648,8 +1639,6 @@ PIKEFUN string string_trim_all_whites (string s)
     case 1: DO_IT (p_wchar1,SPACECASE16); break;
     case 2: DO_IT (p_wchar2,SPACECASE16); break;
 #undef DO_IT
-#undef SPACECASE8
-#undef SPACECASE16
   }
   RETURN string_slice (s, start, end + 1 - start);
 }
-- 
GitLab