comparison src/regex.c @ 282:c42ec1d1cded r21-0b39

Import from CVS: tag r21-0b39
author cvs
date Mon, 13 Aug 2007 10:33:18 +0200
parents ca9a9ec9c1c1
children 558f606b08ae
comparison
equal deleted inserted replaced
281:090b52736db2 282:c42ec1d1cded
131 typedef int Emchar; 131 typedef int Emchar;
132 132
133 #define INC_CHARPTR(p) ((p)++) 133 #define INC_CHARPTR(p) ((p)++)
134 #define DEC_CHARPTR(p) ((p)--) 134 #define DEC_CHARPTR(p) ((p)--)
135 135
136 /* When used in Emacs's lib-src, we need to get bzero and bcopy somehow.
137 If nothing else has been done, use the method below. */
138 #ifdef INHIBIT_STRING_HEADER
139 #if !(defined (HAVE_BZERO) && defined (HAVE_BCOPY))
140 #if !defined (bzero) && !defined (bcopy)
141 #undef INHIBIT_STRING_HEADER
142 #endif
143 #endif
144 #endif
145
146 /* This is the normal way of making sure we have a bcopy and a bzero.
147 This is used in most programs--a few other programs avoid this
148 by defining INHIBIT_STRING_HEADER. */
149 #ifndef INHIBIT_STRING_HEADER
150 #if defined (HAVE_STRING_H) || defined (STDC_HEADERS) || defined (_LIBC)
151 #include <string.h> 136 #include <string.h>
152 #ifndef bcmp
153 #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
154 #endif
155 #ifndef bcopy
156 #define bcopy(s, d, n) memcpy ((d), (s), (n))
157 #endif
158 #ifndef bzero
159 #define bzero(s, n) memset ((s), 0, (n))
160 #endif
161 #else
162 #include <strings.h>
163 #endif
164 #endif
165
166 137
167 /* Define the syntax stuff for \<, \>, etc. */ 138 /* Define the syntax stuff for \<, \>, etc. */
168 139
169 /* This must be nonzero for the wordchar and notwordchar pattern 140 /* This must be nonzero for the wordchar and notwordchar pattern
170 commands in re_match_2. */ 141 commands in re_match_2. */
2265 2236
2266 /* Push the number of bytes in the bitmap. */ 2237 /* Push the number of bytes in the bitmap. */
2267 BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); 2238 BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
2268 2239
2269 /* Clear the whole map. */ 2240 /* Clear the whole map. */
2270 bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH); 2241 memset (b, 0, (1 << BYTEWIDTH) / BYTEWIDTH);
2271 2242
2272 /* charset_not matches newline according to a syntax bit. */ 2243 /* charset_not matches newline according to a syntax bit. */
2273 if ((re_opcode_t) b[-2] == charset_not 2244 if ((re_opcode_t) b[-2] == charset_not
2274 && (syntax & RE_HAT_LISTS_NOT_NEWLINE)) 2245 && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
2275 SET_LIST_BIT ('\n'); 2246 SET_LIST_BIT ('\n');
3425 boolean succeed_n_p = false; 3396 boolean succeed_n_p = false;
3426 3397
3427 assert (fastmap != NULL && p != NULL); 3398 assert (fastmap != NULL && p != NULL);
3428 3399
3429 INIT_FAIL_STACK (); 3400 INIT_FAIL_STACK ();
3430 bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ 3401 memset (fastmap, 0, 1 << BYTEWIDTH); /* Assume nothing's valid. */
3431 bufp->fastmap_accurate = 1; /* It will be when we're done. */ 3402 bufp->fastmap_accurate = 1; /* It will be when we're done. */
3432 bufp->can_be_null = 0; 3403 bufp->can_be_null = 0;
3433 3404
3434 while (1) 3405 while (1)
3435 { 3406 {