diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:25 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:25 -0800 |
commit | db04688faa20f3576257c0fe41752ec435beab9a (patch) | |
tree | 6d638c2e1f65afd5f49d20b2d22ce35bd74705ff /rgx.c | |
parent | 1edcb9b62a1a520eddae8403c19d841c9b18737f (diff) | |
download | scm-db04688faa20f3576257c0fe41752ec435beab9a.tar.gz scm-db04688faa20f3576257c0fe41752ec435beab9a.zip |
Import Upstream version 5c3upstream/5c3
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); |