diff options
Diffstat (limited to 'rgx.c')
-rw-r--r-- | rgx.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -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 <alloca.h> @@ -131,7 +131,7 @@ int prinregex(exp, port, writing) SCM exp; SCM port; int writing; { lputs("#<regex ", port); - intprint(CDR(exp), 16, port); + intprint(CDR(exp), -16, port); lputc(' ', port); iprin1(RGX_PATTERN(exp), port, writing); lputc('>', 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); |