comparison src/regex.c @ 157:6b37e6ddd302 r20-3b5

Import from CVS: tag r20-3b5
author cvs
date Mon, 13 Aug 2007 09:40:41 +0200
parents 1370575f1259
children 0132846995bd
comparison
equal deleted inserted replaced
156:60baf0b43294 157:6b37e6ddd302
3247 3247
3248 static reg_errcode_t 3248 static reg_errcode_t
3249 compile_extended_range (CONST char **p_ptr, CONST char *pend, char *translate, 3249 compile_extended_range (CONST char **p_ptr, CONST char *pend, char *translate,
3250 reg_syntax_t syntax, Lisp_Object rtab) 3250 reg_syntax_t syntax, Lisp_Object rtab)
3251 { 3251 {
3252 Emchar this_char; 3252 Emchar this_char, range_start, range_end;
3253 3253 CONST Bufbyte *p;
3254 CONST char *p = *p_ptr;
3255 EMACS_INT range_start, range_end;
3256 3254
3257 if (p == pend) 3255 if (*p_ptr == pend)
3258 return REG_ERANGE; 3256 return REG_ERANGE;
3259 3257
3258 p = (CONST Bufbyte *) *p_ptr;
3259 range_end = charptr_emchar (p);
3260 p--; /* back to '-' */ 3260 p--; /* back to '-' */
3261 DEC_CHARPTR (p); /* back to start of range */ 3261 DEC_CHARPTR (p); /* back to start of range */
3262 /* We also want to fetch the endpoints without translating them; the 3262 /* We also want to fetch the endpoints without translating them; the
3263 appropriate translation is done in the bit-setting loop below. */ 3263 appropriate translation is done in the bit-setting loop below. */
3264 range_start = charptr_emchar ((CONST Bufbyte *) p); 3264 range_start = charptr_emchar (p);
3265 range_end = charptr_emchar ((CONST Bufbyte *) (*p_ptr));
3266 INC_CHARPTR (*p_ptr); 3265 INC_CHARPTR (*p_ptr);
3267 3266
3268 /* If the start is after the end, the range is empty. */ 3267 /* If the start is after the end, the range is empty. */
3269 if (range_start > range_end) 3268 if (range_start > range_end)
3270 return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR; 3269 return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
3635 #ifdef MULE 3634 #ifdef MULE
3636 /* 97/2/17 jhod category patch */ 3635 /* 97/2/17 jhod category patch */
3637 case categoryspec: 3636 case categoryspec:
3638 case notcategoryspec: 3637 case notcategoryspec:
3639 bufp->can_be_null = 1; 3638 bufp->can_be_null = 1;
3640 return; 3639 return 0;
3641 /* end if category patch */ 3640 /* end if category patch */
3642 #endif /* MULE */ 3641 #endif /* MULE */
3643 3642
3644 /* All cases after this match the empty string. These end with 3643 /* All cases after this match the empty string. These end with
3645 `continue'. */ 3644 `continue'. */