From db04688faa20f3576257c0fe41752ec435beab9a Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Feb 2017 00:05:25 -0800 Subject: Import Upstream version 5c3 --- rgx.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'rgx.c') diff --git a/rgx.c b/rgx.c index 974116a..1006cf8 100644 --- a/rgx.c +++ b/rgx.c @@ -51,7 +51,7 @@ #endif static char rcsid[] = - "$Id: rgx.c, v 1.20 1995/02/15 04:39:45 dpb Exp $"; + "$Id: rgx.c,v 1.4 1998/09/11 18:13:43 radey Exp $"; #ifdef HAVE_ALLOCA # include @@ -131,7 +131,7 @@ int prinregex(exp, port, writing) SCM exp; SCM port; int writing; { lputs("#', port); @@ -192,9 +192,10 @@ SCM lregcomp(pattern, flags) ASSERT(NIMP(pattern) && STRINGP(pattern), pattern, ARG1, s_regcomp); ASSERT(UNBNDP(flags) || (NIMP(flags) && STRINGP(flags)), flags, ARG2, s_regcomp); - NEWCELL(z); DEFER_INTS; - SETCHARS(z, info=(regex_info*)must_malloc((long)sizeof(regex_info), s_regex)); + z = must_malloc_cell((long)sizeof(regex_info), s_regex); + scm_protect_temp(&z); + info=(regex_info*)CHARS(z); prog = &(info->rgx); CAR(z) = tc16_rgx; #ifdef __REGEXP_LIBRARY_H__ @@ -250,12 +251,19 @@ SCM lregcomp(pattern, flags) DEFER_INTS; if (fastmap) prog->fastmap = must_malloc(CHAR_SET_SIZE, s_regex); + else + prog->fastmap = NULL; if (ignore_case) { prog->translate = must_malloc(CHAR_SET_SIZE, s_regex); for (i = 0; i < CHAR_SET_SIZE; i++) prog->translate[i] = ISUPPER (i) ? tolower (i) : i; } + else + prog->translate = NULL; + + prog->buffer = NULL; + prog->allocated = 0; re_set_syntax(options); err_msg = (char *)re_compile_pattern(CHARS(pattern), LENGTH(pattern), prog); -- cgit v1.2.3