comparison lib-src/etags.c @ 37719:9c4fdf982ba2

(add_regex): Reset the whole newly allocated pattern buffer instead of the individual members. It's safer and works with Xemacs.
author Francesco Potortì <pot@gnu.org>
date Mon, 14 May 2001 12:57:11 +0000
parents 3b55af162cd3
children a7f40b000353
comparison
equal deleted inserted replaced
37718:bffcf33fd50d 37719:9c4fdf982ba2
30 * 2001 Nested classes by Francesco Potort́ based on work by Mykola Dzyuba. 30 * 2001 Nested classes by Francesco Potort́ based on work by Mykola Dzyuba.
31 * 31 *
32 * Francesco Potort́ <pot@gnu.org> has maintained it since 1993. 32 * Francesco Potort́ <pot@gnu.org> has maintained it since 1993.
33 */ 33 */
34 34
35 char pot_etags_version[] = "@(#) pot revision number is 14.18"; 35 char pot_etags_version[] = "@(#) pot revision number is 14.20";
36 36
37 #define TRUE 1 37 #define TRUE 1
38 #define FALSE 0 38 #define FALSE 0
39 39
40 #ifdef DEBUG 40 #ifdef DEBUG
5153 add_regex (regexp_pattern, ignore_case, lang) 5153 add_regex (regexp_pattern, ignore_case, lang)
5154 char *regexp_pattern; 5154 char *regexp_pattern;
5155 bool ignore_case; 5155 bool ignore_case;
5156 language *lang; 5156 language *lang;
5157 { 5157 {
5158 static struct re_pattern_buffer zeropattern;
5158 char *name; 5159 char *name;
5159 const char *err; 5160 const char *err;
5160 struct re_pattern_buffer *patbuf; 5161 struct re_pattern_buffer *patbuf;
5161 pattern *pp; 5162 pattern *pp;
5162 5163
5173 return; 5174 return;
5174 } 5175 }
5175 (void) scan_separators (name); 5176 (void) scan_separators (name);
5176 5177
5177 patbuf = xnew (1, struct re_pattern_buffer); 5178 patbuf = xnew (1, struct re_pattern_buffer);
5178 /* Translation table to fold case if appropriate. */ 5179 *patbuf = zeropattern;
5179 patbuf->translate = (ignore_case) ? lc_trans : NULL; 5180 if (ignore_case)
5180 patbuf->fastmap = NULL; 5181 patbuf->translate = lc_trans; /* translation table to fold case */
5181 patbuf->buffer = NULL;
5182 patbuf->allocated = 0;
5183 5182
5184 err = re_compile_pattern (regexp_pattern, strlen (regexp_pattern), patbuf); 5183 err = re_compile_pattern (regexp_pattern, strlen (regexp_pattern), patbuf);
5185 if (err != NULL) 5184 if (err != NULL)
5186 { 5185 {
5187 error ("%s while compiling pattern", err); 5186 error ("%s while compiling pattern", err);