summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-02-16 06:21:20 -0700
committerEric Blake <ebb9@byu.net>2009-02-16 06:30:45 -0700
commita2cdd6be73989df7e62caa8bfc55327fee3c9fac (patch)
treefb888cdb838c5aab110825c12090b2751773a8ab
parentefb88298e6f6933335f9cdfb1d96753271052efb (diff)
downloadm4-a2cdd6be73989df7e62caa8bfc55327fee3c9fac.tar.gz
Fix regression in multicharacter quotes, from 2008-01-26.
* m4/input.c (m4__next_token): Fix typo. * tests/builtins.at (changequote): Enhance test. Signed-off-by: Eric Blake <ebb9@byu.net>
-rw-r--r--ChangeLog6
-rw-r--r--m4/input.c20
-rw-r--r--tests/builtins.at4
3 files changed, 20 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 6717a8a3..90957fd5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-02-16 Eric Blake <ebb9@byu.net>
+
+ Fix regression in multicharacter quotes, from 2008-01-26.
+ * m4/input.c (m4__next_token): Fix typo.
+ * tests/builtins.at (changequote): Enhance test.
+
2009-02-13 Eric Blake <ebb9@byu.net>
Speed up parsing when detecting input file change.
diff --git a/m4/input.c b/m4/input.c
index 26723867..ba2e467a 100644
--- a/m4/input.c
+++ b/m4/input.c
@@ -1418,15 +1418,15 @@ match_input (m4 *context, const char *s, size_t len, bool consume)
}
/* The macro MATCH() is used to match a string S of length LEN against
- the input. The first character is handled inline for speed, and
- S[LEN] must be safe to dereference (it is faster to do character
- comparison prior to length checks). This improves efficiency for
- the common case of single character quotes and comment delimiters,
- while being safe for disabled delimiters as well as longer
- delimiters. If CONSUME, then CH is the result of next_char, and a
- successful match will discard the matched string. Otherwise, CH is
- the result of peek_char, and the input stream is effectively
- unchanged. */
+ the input. The first character is handled inline for speed, and
+ S[LEN] must be safe to dereference (it is faster to do character
+ comparison prior to length checks). This improves efficiency for
+ the common case of single character quotes and comment delimiters,
+ while being safe for disabled delimiters as well as longer
+ delimiters. If CONSUME, then CH is the result of next_char, and a
+ successful match will discard the matched string. Otherwise, CH is
+ the result of peek_char, and the input stream is effectively
+ unchanged. */
#define MATCH(C, ch, s, len, consume) \
(to_uchar ((s)[0]) == (ch) \
&& ((len) >> 1 ? match_input (C, s, len, consume) : (len)))
@@ -1678,7 +1678,7 @@ m4__next_token (m4 *context, m4_symbol_value *token, int *line,
{
quote_level++;
obstack_grow (obs_safe, context->syntax->quote.str1,
- context->syntax->quote.len2);
+ context->syntax->quote.len1);
}
else
obstack_1grow (obs_safe, ch);
diff --git a/tests/builtins.at b/tests/builtins.at
index 397f649c..46ce5482 100644
--- a/tests/builtins.at
+++ b/tests/builtins.at
@@ -133,11 +133,15 @@ AT_DATA([in.m4],
[[define(`aaaaaaaaaaaaaaaaaaaa', `A')define(`q', `"$@"')
changequote(`"', `"')
q(q("aaaaaaaaaaaaaaaaaaaa", "a"))
+changequote`'define(`echo', `$@')dnl
+changequote(`<<<', `>>')dnl
+echo(<<<a<<<b>>>>)
]])
AT_CHECK_M4([in.m4], [0], [[
A,a
+a<<<b>>
]])
AT_CLEANUP