changeset 15850:ffd1a99733bd

build: Check for isascii() before using it. * configure.ac: Add AC_CHECK_FUNCS line for isascii. * libinterp/octave-value/ov-ch-mat.cc(xisascii): test HAVE_ISASCII before using isascii().
author Rik <rik@octave.org>
date Wed, 26 Dec 2012 11:14:46 -0800
parents e55a64f49346
children 4bfe605f5ecf
files configure.ac libinterp/octave-value/ov-ch-mat.cc
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Tue Dec 25 22:15:02 2012 +0100
+++ b/configure.ac	Wed Dec 26 11:14:46 2012 -0800
@@ -1941,7 +1941,8 @@
 AC_CHECK_FUNCS([endgrent endpwent execvp expm1 expm1f fork])
 AC_CHECK_FUNCS([getegid geteuid getgid getgrent getgrgid getgrnam])
 AC_CHECK_FUNCS([getpgrp getpid getppid getpwent getpwuid getuid])
-AC_CHECK_FUNCS([kill lgamma lgammaf lgamma_r lgammaf_r])
+AC_CHECK_FUNCS([isascii kill])
+AC_CHECK_FUNCS([lgamma lgammaf lgamma_r lgammaf_r])
 AC_CHECK_FUNCS([log1p log1pf pipe])
 AC_CHECK_FUNCS([realpath resolvepath roundl])
 AC_CHECK_FUNCS([select setgrent setpwent siglongjmp strsignal])
--- a/libinterp/octave-value/ov-ch-mat.cc	Tue Dec 25 22:15:02 2012 +0100
+++ b/libinterp/octave-value/ov-ch-mat.cc	Wed Dec 26 11:14:46 2012 -0800
@@ -154,11 +154,17 @@
 
 // The C++ standard guarantees cctype defines functions, not macros (and
 // hence macros *CAN'T* be defined if only cctype is included) so
-// there's no need to fuck around. The exceptions are isascii and
-// toascii, which are not C++. Oddly enough, all those character
-// functions are int (*) (int), even in C++. Wicked!
+// there's no need to fuck around.  The exceptions are isascii and
+// toascii, which are not C++.  Oddly enough, all those character
+// functions are int (*) (int), even in C++.  Wicked!
 static inline int xisascii (int c)
-{ return isascii (c); }
+{
+#ifdef HAVE_ISASCII
+  return isascii (c);
+#else
+  return (c >= 0x00 && c <= 0x7f);
+#endif
+}
 
 static inline int xtoascii (int c)
 {