[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to m4/src/Attic/builtin.c,v [branch-1_4]
From: |
Eric Blake |
Subject: |
Changes to m4/src/Attic/builtin.c,v [branch-1_4] |
Date: |
Tue, 09 Oct 2007 16:55:09 +0000 |
CVSROOT: /sources/m4
Module name: m4
Branch: branch-1_4
Changes by: Eric Blake <ericb> 07/10/09 16:55:08
Index: src/builtin.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/builtin.c,v
retrieving revision 1.1.1.1.2.65
retrieving revision 1.1.1.1.2.66
diff -u -b -r1.1.1.1.2.65 -r1.1.1.1.2.66
--- src/builtin.c 9 Oct 2007 16:51:09 -0000 1.1.1.1.2.65
+++ src/builtin.c 9 Oct 2007 16:55:08 -0000 1.1.1.1.2.66
@@ -2009,6 +2009,7 @@
/* Fall through. */
case '&':
+ if (regs)
obstack_grow (obs, victim + regs->start[0],
regs->end[0] - regs->start[0]);
break;
@@ -2016,7 +2017,7 @@
case '1': case '2': case '3': case '4': case '5': case '6':
case '7': case '8': case '9':
ch -= '0';
- if (regs->num_regs - 1 <= ch)
+ if (!regs || regs->num_regs - 1 <= ch)
M4ERROR ((warning_status, 0,
"Warning: sub-expression %d not present", ch));
else if (regs->end[ch] > 0)
@@ -2054,12 +2055,12 @@
}
}
-/*--------------------------------------------------------------------------.
-| Regular expression version of index. Given two arguments, expand to the |
-| index of the first match of the second argument (a regexp) in the first. |
-| Expand to -1 if here is no match. Given a third argument, is changes
|
-| the expansion to this argument. |
-`--------------------------------------------------------------------------*/
+/*------------------------------------------------------------------.
+| Regular expression version of index. Given two arguments, expand |
+| to the index of the first match of the second argument (a regexp) |
+| in the first. Expand to -1 if there is no match. Given a third |
+| argument, a match is substituted according to this argument. |
+`------------------------------------------------------------------*/
static void
m4_regexp (struct obstack *obs, int argc, token_data **argv)
@@ -2092,7 +2093,7 @@
if (argc == 3)
shipout_int (obs, 0);
else
- obstack_grow (obs, repl, strlen (repl));
+ substitute (obs, victim, repl, NULL);
return;
}
@@ -2118,12 +2119,13 @@
substitute (obs, victim, repl, regs);
}
-/*--------------------------------------------------------------------------.
-| Substitute all matches of a regexp occuring in a string. Each match of |
-| the second argument (a regexp) in the first argument is changed to the |
-| third argument, with \& substituted by the matched text, and \N |
-| substituted by the text matched by the Nth parenthesized sub-expression. |
-`--------------------------------------------------------------------------*/
+/*------------------------------------------------------------------.
+| Substitute all matches of a regexp occurring in a string. Each |
+| match of the second argument (a regexp) in the first argument is |
+| changed to the third argument, with \& substituted by the matched |
+| text, and \N substituted by the text matched by the Nth |
+| parenthesized sub-expression. |
+`------------------------------------------------------------------*/
static void
m4_patsubst (struct obstack *obs, int argc, token_data **argv)
- Changes to m4/src/Attic/builtin.c,v [branch-1_4], Eric Blake, 2007/10/02
- Changes to m4/src/Attic/builtin.c,v [branch-1_4], Eric Blake, 2007/10/09
- Changes to m4/src/Attic/builtin.c,v [branch-1_4],
Eric Blake <=
- Changes to m4/src/Attic/builtin.c,v [branch-1_4], Eric Blake, 2007/10/22
- Changes to m4/src/Attic/builtin.c,v [branch-1_4], Eric Blake, 2007/10/22