[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Miscellaneous code readability improvements.
From: |
Eric Blake |
Subject: |
Re: [PATCH] Miscellaneous code readability improvements. |
Date: |
Thu, 27 Aug 2009 16:58:03 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Joel E. Denny <jdenny <at> clemson.edu> writes:
> char const *p = yytext + 1;
> - if (*p == ' ')
> - p = "` '";
> + char quoted_ws[] = "` '";
> + if (isspace (*p) && isprint (*p))
Oops. Non-portable code, since an 8-bit signed char falls outside of the valid
domain of is* (cygwin's headers catch this bug, and I have a pending bug
request asking glibc to warn in this case, too):
scan-gram.l: In function `gram_lex':
scan-gram.l:621: warning: subscript has type `char'
scan-gram.l:621: warning: subscript has type `char'
OK to apply this fix?
From: Eric Blake <address@hidden>
Date: Thu, 27 Aug 2009 10:56:53 -0600
Subject: [PATCH] scan-gram: avoid portability trap with ctype usage.
* src/scan-gram.l (splice): Avoid compiler warning.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 5 +++++
src/scan-gram.l | 2 +-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index aaeb444..20b31c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-27 Eric Blake <address@hidden>
+
+ scan-gram: avoid portability trap with ctype usage.
+ * src/scan-gram.l (splice): Avoid compiler warning.
+
2009-08-27 Joel E. Denny <address@hidden>
tests: use perl for printing special sequences to files.
diff --git a/src/scan-gram.l b/src/scan-gram.l
index 93e0d10..bcb7209 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -618,7 +618,7 @@ splice (\\[ \f\t\v]*\n)*
\\(.|\n) {
char const *p = yytext + 1;
/* Quote only if escaping won't make the character visible. */
- if (isspace (*p) && isprint (*p))
+ if (isspace ((unsigned char) *p) && isprint ((unsigned char) *p))
p = quote (p);
else
p = quotearg_style_mem (escape_quoting_style, p, 1);
--
1.6.3.2
- Re: [PATCH] Miscellaneous code readability improvements., (continued)
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/13
- Re: [PATCH] Miscellaneous code readability improvements., Akim Demaille, 2009/08/13
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/13
- Re: [PATCH] Miscellaneous code readability improvements., Akim Demaille, 2009/08/13
- Re: [PATCH] Miscellaneous code readability improvements., Akim Demaille, 2009/08/14
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/18
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/19
- Re: [PATCH] Miscellaneous code readability improvements., Akim Demaille, 2009/08/19
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/19
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/21
- Re: [PATCH] Miscellaneous code readability improvements.,
Eric Blake <=
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/27
- Re: [PATCH] Miscellaneous code readability improvements., Eric Blake, 2009/08/27
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/27
- Re: [PATCH] Miscellaneous code readability improvements., Eric Blake, 2009/08/27
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/28
- Re: [PATCH] Miscellaneous code readability improvements., Eric Blake, 2009/08/28
- Re: [PATCH] Miscellaneous code readability improvements., Joel E. Denny, 2009/08/29