Thread (34 messages) flat view 34 messages, 7 authors, 2016-06-15

Re: [PATCH v5 02/12] ctype: support iscntrl, ispunct, isxdigit and isprint

From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:55:03

On Wed, Oct 17, 2012 at 7:09 PM, "Jan H. Schönherr"
[off-list ref] wrote:
quoted
 const unsigned char sane_ctype[256] = {
-     0, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, 0, S, 0, 0,         /*   0.. 15 */
-     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,         /*  16.. 31 */
+     X, X, X, X, X, X, X, X, X, Z, Z, X, X, Z, X, X,         /*   0.. 15 */
+     X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X,         /*  16.. 31 */
"Normal" isspace() also includes vertical tab (11) and form-feed (12) as
white-space characters. Is there a reason, why they are not included here?
I'm not sure. They were not classified as spaces in the very first
version in 4546738 (Unlocalized isspace and friends - 2005-10-13).
Maybe Linus had a reason to do so.
quoted
+#define isprint(x) (sane_istest(x, GIT_ALPHA | GIT_DIGIT | GIT_SPACE | \
+             GIT_PUNCT | GIT_REGEX_SPECIAL | GIT_GLOB_SPECIAL | \
+             GIT_PATHSPEC_MAGIC))
"Normal" isprint() only includes space (32) from the white-space characters.
The other white-space characters are not considered printable.

Do we want to stay close to the "original", or not?
We do. I followed [1] but obvious missed the last sentence in "print"
description: "No characters specified for the keyword cntrl shall be
specified". Thanks for catching. I'll fix it soon.

[1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help