projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
33e03ff
)
Assume ANSI C.
author
Bruno Haible
<bruno@clisp.org>
Tue, 4 Jul 2006 16:46:23 +0000
(16:46 +0000)
committer
Bruno Haible
<bruno@clisp.org>
Tue, 4 Jul 2006 16:46:23 +0000
(16:46 +0000)
lib/ChangeLog
patch
|
blob
|
history
lib/mbswidth.c
patch
|
blob
|
history
diff --git
a/lib/ChangeLog
b/lib/ChangeLog
index 244118bbf25e4f75d1643073743861206b76d069..c0fdd3a4d1cb484c154eee12b078e42d2bd15c2d 100644
(file)
--- a/
lib/ChangeLog
+++ b/
lib/ChangeLog
@@
-1,3
+1,9
@@
+2006-06-27 Bruno Haible <bruno@clisp.org>
+
+ Assume ANSI C header files and <ctype.h> functions.
+ * mbswidth.c (IN_CTYPE_DOMAIN, ISPRINT, ISCNTRL): Remove macros.
+ (mbsnwidth): Use isprint, iscntrl instead.
+
2006-07-03 Jim Meyering <jim@meyering.net>
* cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Abort if this
2006-07-03 Jim Meyering <jim@meyering.net>
* cycle-check.h (CYCLE_CHECK_REFLECT_CHDIR_UP): Abort if this
diff --git
a/lib/mbswidth.c
b/lib/mbswidth.c
index ef8398a78674063d5c8b992c26287e07ca36e9b8..48da6639dc112e683eeba4b546caf0241609cff5 100644
(file)
--- a/
lib/mbswidth.c
+++ b/
lib/mbswidth.c
@@
-60,18
+60,6
@@
# endif
#endif
# endif
#endif
-/* Get ISPRINT. */
-#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
-# define IN_CTYPE_DOMAIN(c) 1
-#else
-# define IN_CTYPE_DOMAIN(c) isascii(c)
-#endif
-/* Undefine to protect against the definition in wctype.h of Solaris 2.6. */
-#undef ISPRINT
-#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
-#undef ISCNTRL
-#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
-
/* Returns the number of columns needed to represent the multibyte
character string pointed to by STRING. If a non-printable character
occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned.
/* Returns the number of columns needed to represent the multibyte
character string pointed to by STRING. If a non-printable character
occurs, and MBSW_REJECT_UNPRINTABLE is specified, -1 is returned.
@@
-195,10
+183,10
@@
mbsnwidth (const char *string, size_t nbytes, int flags)
{
unsigned char c = (unsigned char) *p++;
{
unsigned char c = (unsigned char) *p++;
- if (
ISPRINT
(c))
+ if (
isprint
(c))
width++;
else if (!(flags & MBSW_REJECT_UNPRINTABLE))
width++;
else if (!(flags & MBSW_REJECT_UNPRINTABLE))
- width += (
ISCNTRL
(c) ? 0 : 1);
+ width += (
iscntrl
(c) ? 0 : 1);
else
return -1;
}
else
return -1;
}