aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1994-02-25 01:30:59 +0000
committerKarl Heuer1994-02-25 01:30:59 +0000
commitf765858ec5069407dadc052cf9163200f85d3605 (patch)
tree4f08abc0ccdf224bd06ee3b60d36b53a4d56b77f
parentf643a89157e34c9ecba78165a1e9b795181c97f3 (diff)
downloademacs-f765858ec5069407dadc052cf9163200f85d3605.tar.gz
emacs-f765858ec5069407dadc052cf9163200f85d3605.zip
*** empty log message ***
-rw-r--r--src/regex.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/regex.c b/src/regex.c
index c66a223f4b7..792d419cc43 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -264,6 +264,8 @@ char *alloca ();
264typedef char boolean; 264typedef char boolean;
265#define false 0 265#define false 0
266#define true 1 266#define true 1
267
268static int re_match_2_internal ();
267 269
268/* These are the command codes that appear in compiled regular 270/* These are the command codes that appear in compiled regular
269 expressions. Some opcodes are followed by argument bytes. A 271 expressions. Some opcodes are followed by argument bytes. A
@@ -3153,8 +3155,10 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
3153 && !bufp->can_be_null) 3155 && !bufp->can_be_null)
3154 return -1; 3156 return -1;
3155 3157
3156 val = re_match_2 (bufp, string1, size1, string2, size2, 3158 val = re_match_2_internal (bufp, string1, size1, string2, size2,
3157 startpos, regs, stop); 3159 startpos, regs, stop);
3160 alloca (0);
3161
3158 if (val >= 0) 3162 if (val >= 0)
3159 return startpos; 3163 return startpos;
3160 3164
@@ -3250,8 +3254,8 @@ static boolean alt_match_null_string_p (),
3250 FREE_VAR (reg_info_dummy); \ 3254 FREE_VAR (reg_info_dummy); \
3251 } while (0) 3255 } while (0)
3252#else /* not REGEX_MALLOC */ 3256#else /* not REGEX_MALLOC */
3253/* Some MIPS systems (at least) want this to free alloca'd storage. */ 3257/* This used to do alloca (0), but now we do that in the caller. */
3254#define FREE_VARIABLES() alloca (0) 3258#define FREE_VARIABLES() /* Nothing */
3255#endif /* not REGEX_MALLOC */ 3259#endif /* not REGEX_MALLOC */
3256#else 3260#else
3257#define FREE_VARIABLES() /* Do nothing! */ 3261#define FREE_VARIABLES() /* Do nothing! */
@@ -3278,8 +3282,11 @@ re_match (bufp, string, size, pos, regs)
3278 const char *string; 3282 const char *string;
3279 int size, pos; 3283 int size, pos;
3280 struct re_registers *regs; 3284 struct re_registers *regs;
3281 { 3285{
3282 return re_match_2 (bufp, NULL, 0, string, size, pos, regs, size); 3286 int result = re_match_2_internal (bufp, NULL, 0, string, size,
3287 pos, regs, size);
3288 alloca (0);
3289 return result;
3283} 3290}
3284#endif /* not emacs */ 3291#endif /* not emacs */
3285 3292
@@ -3306,6 +3313,23 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
3306 struct re_registers *regs; 3313 struct re_registers *regs;
3307 int stop; 3314 int stop;
3308{ 3315{
3316 int result = re_match_2_internal (bufp, string1, size1, string2, size2,
3317 pos, regs, stop);
3318 alloca (0);
3319 return result;
3320}
3321
3322/* This is a separate function so that we can force an alloca cleanup
3323 afterwards. */
3324static int
3325re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
3326 struct re_pattern_buffer *bufp;
3327 const char *string1, *string2;
3328 int size1, size2;
3329 int pos;
3330 struct re_registers *regs;
3331 int stop;
3332{
3309 /* General temporaries. */ 3333 /* General temporaries. */
3310 int mcnt; 3334 int mcnt;
3311 unsigned char *p1; 3335 unsigned char *p1;