File otp_src_R15B03-1-erts-ctype.patch of Package erlang

diff -Ndurp otp_src_R15B03-1/erts/emulator/beam/bif.c otp_src_R15B03-1-erts-ctype/erts/emulator/beam/bif.c
--- otp_src_R15B03-1/erts/emulator/beam/bif.c	2012-12-06 16:02:45.000000000 +0200
+++ otp_src_R15B03-1-erts-ctype/erts/emulator/beam/bif.c	2015-01-16 12:07:15.977073626 +0200
@@ -21,6 +21,8 @@
 #  include "config.h"
 #endif
 
+#include <ctype.h>
+
 #include <stddef.h> /* offsetof() */
 #include "sys.h"
 #include "erl_vm.h"
@@ -2883,7 +2885,6 @@ BIF_RETTYPE float_to_list_1(BIF_ALIST_1)
 
 #define IS_DOT(x) (unsigned_val((x)) == '.' || unsigned_val((x)) == ',')
 #define IS_E(x) (unsigned_val((x)) == 'e' || unsigned_val((x)) == 'E')
-#define IS_DIGIT(x) (unsigned_val((x)) >= '0' && unsigned_val((x)) <= '9')
 #define SAVE_E(xi,xim,xl,xlm) ((xim)=(xi), (xlm)=(xl))
 #define LOAD_E(xi,xim,xl,xlm) ((xi)=(xim), (xl)=(xlm))
 
@@ -2990,7 +2991,7 @@ BIF_RETTYPE string_to_float_1(BIF_ALIST_
 	    default:		/* unexpected - done */
 		part = END;
 	    }
-	} else if (IS_DIGIT(CAR(list_val(list)))) { /* digit */
+	} else if (isdigit(unsigned_val(CAR(list_val(list))))) { /* digit */
 	    switch (part) {
 	    case SIGN:		/* got initial digit in integer part */
 		part = INT;	/* expect more digits to follow */
diff -Ndurp otp_src_R15B03-1/erts/emulator/beam/erl_printf_term.c otp_src_R15B03-1-erts-ctype/erts/emulator/beam/erl_printf_term.c
--- otp_src_R15B03-1/erts/emulator/beam/erl_printf_term.c	2012-12-06 16:02:45.000000000 +0200
+++ otp_src_R15B03-1-erts-ctype/erts/emulator/beam/erl_printf_term.c	2015-01-16 12:07:15.977073626 +0200
@@ -21,6 +21,8 @@
 #  include "config.h"
 #endif
 
+#include <ctype.h>
+
 #include "erl_printf_term.h"
 #include "sys.h"
 #include "big.h"
@@ -81,36 +83,6 @@ do {									\
     (CNT) += res__;							\
 } while (0)
 
-/* CTYPE macros */
-
-#define LATIN1
-
-#define IS_DIGIT(c)  ((c) >= '0' && (c) <= '9')
-#ifdef LATIN1
-#define IS_LOWER(c)  (((c) >= 'a' && (c) <= 'z') \
-		      || ((c) >= 128+95 && (c) <= 255 && (c) != 247))
-#define IS_UPPER(c)  (((c) >= 'A' && (c) <= 'Z') \
-		      || ((c) >= 128+64 && (c) <= 128+94 && (c) != 247-32))
-#else
-#define IS_LOWER(c)  ((c) >= 'a' && (c) <= 'z')
-#define IS_UPPER(c)  ((c) >= 'A' && (c) <= 'Z')
-#endif
-
-#define IS_ALNUM(c)  (IS_DIGIT(c) || IS_LOWER(c) || IS_UPPER(c))
-
-/* We don't include 160 (non-breaking space). */
-#define IS_SPACE(c)  (c == ' ' || c == '\n' || c == '\t' || c == '\r')
-
-#ifdef LATIN1
-#define IS_CNTRL(c)  ((c) < ' ' || (c) == 127 \
-		      || ((c) >= 128 && (c) < 128+32))
-#else
-/* Treat all non-ASCII as control characters */
-#define IS_CNTRL(c)  ((c) < ' ' || (c) >= 127)
-#endif
-
-#define IS_PRINT(c)  (!IS_CNTRL(c))
-
 /* return 0 if list is not a non-empty flat list of printable characters */
 
 static int
@@ -126,8 +98,7 @@ is_printable_string(Eterm list, Eterm* b
 	if (!is_byte(hd))
 	    return 0;
 	c = signed_val(hd);
-	/* IS_PRINT || IS_SPACE would be another way to put it */
-	if (IS_CNTRL(c) && !IS_SPACE(c))
+	if (iscntrl(c) && !isspace(c))
 	   return 0;
 	len++;
 	list = CDR(consp);
@@ -174,12 +145,12 @@ static int print_atom_name(fmtfn_t fn, v
     pos = n - 1;
 
     c = *cpos++;
-    if (!IS_LOWER(c))
+    if (!islower(c))
 	need_quote++;
     else {
 	while (pos--) {
 	    c = *cpos++;
-	    if (!IS_ALNUM(c) && (c != '_')) {
+	    if (!isalnum(c) && (c != '_')) {
 		need_quote++;
 		break;
 	    }
@@ -201,7 +172,7 @@ static int print_atom_name(fmtfn_t fn, v
 	case '\b': PRINT_STRING(res, fn, arg, "\\b"); break;
 	case '\v': PRINT_STRING(res, fn, arg, "\\v"); break;
 	default:
-	    if (IS_CNTRL(c)) {
+	    if (iscntrl(c)) {
 		PRINT_CHAR(res, fn, arg, '\\');
 		PRINT_ULONG(res, fn, arg, 'o', 1, 3, (unsigned long) c);
 	    }
diff -Ndurp otp_src_R15B03-1/erts/emulator/beam/utils.c otp_src_R15B03-1-erts-ctype/erts/emulator/beam/utils.c
--- otp_src_R15B03-1/erts/emulator/beam/utils.c	2012-12-06 16:02:45.000000000 +0200
+++ otp_src_R15B03-1-erts-ctype/erts/emulator/beam/utils.c	2015-01-16 12:07:15.977073626 +0200
@@ -21,6 +21,8 @@
 #  include "config.h"
 #endif
 
+#include <ctype.h>
+
 #define ERTS_DO_INCL_GLB_INLINE_FUNC_DEF
 
 #include "sys.h"
@@ -219,36 +221,6 @@ erl_grow_wstack(UWord** start, UWord** s
     *sp = *start + sp_offs;
 }
 
-/* CTYPE macros */
-
-#define LATIN1
-
-#define IS_DIGIT(c)  ((c) >= '0' && (c) <= '9')
-#ifdef LATIN1
-#define IS_LOWER(c)  (((c) >= 'a' && (c) <= 'z') \
-		      || ((c) >= 128+95 && (c) <= 255 && (c) != 247))
-#define IS_UPPER(c)  (((c) >= 'A' && (c) <= 'Z') \
-		      || ((c) >= 128+64 && (c) <= 128+94 && (c) != 247-32))
-#else
-#define IS_LOWER(c)  ((c) >= 'a' && (c) <= 'z')
-#define IS_UPPER(c)  ((c) >= 'A' && (c) <= 'Z')
-#endif
-
-#define IS_ALNUM(c)  (IS_DIGIT(c) || IS_LOWER(c) || IS_UPPER(c))
-
-/* We don't include 160 (non-breaking space). */
-#define IS_SPACE(c)  (c == ' ' || c == '\n' || c == '\t' || c == '\r')
-
-#ifdef LATIN1
-#define IS_CNTRL(c)  ((c) < ' ' || (c) == 127 \
-		      || ((c) >= 128 && (c) < 128+32))
-#else
-/* Treat all non-ASCII as control characters */
-#define IS_CNTRL(c)  ((c) < ' ' || (c) >= 127)
-#endif
-
-#define IS_PRINT(c)  (!IS_CNTRL(c))
-
 /*
  * Calculate length of a list.
  * Returns -1 if not a proper list (i.e. not terminated with NIL)
@@ -2874,9 +2846,9 @@ void bin_write(int to, void *to_arg, byt
     size_t i;
 
     for (i=0;i<sz;i++) {
-	if (IS_DIGIT(buf[i]))
+	if (isdigit(buf[i]))
 	    erts_print(to, to_arg, "%d,", buf[i]);
-	else if (IS_PRINT(buf[i])) {
+	else if (isprint(buf[i]) || buf[i] > 127) {
 	    erts_print(to, to_arg, "%c,", buf[i]);
 	}
 	else