Mercurial > hg > octave-kai > gnulib-hg
comparison regex.c @ 490:985fe9826996
(re_search_2): Use 0, not -1, as the lower bound
for the match position when we adjust RANGE.
author | Richard Stallman <rms@gnu.org> |
---|---|
date | Sun, 01 Oct 1995 20:17:02 +0000 |
parents | 35afc74165b7 |
children | f29b13c2cefd |
comparison
equal
deleted
inserted
replaced
489:0874493f99ac | 490:985fe9826996 |
---|---|
3257 /* Check for out-of-range STARTPOS. */ | 3257 /* Check for out-of-range STARTPOS. */ |
3258 if (startpos < 0 || startpos > total_size) | 3258 if (startpos < 0 || startpos > total_size) |
3259 return -1; | 3259 return -1; |
3260 | 3260 |
3261 /* Fix up RANGE if it might eventually take us outside | 3261 /* Fix up RANGE if it might eventually take us outside |
3262 the virtual concatenation of STRING1 and STRING2. */ | 3262 the virtual concatenation of STRING1 and STRING2. |
3263 if (endpos < -1) | 3263 Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE. */ |
3264 range = -1 - startpos; | 3264 if (endpos < 0) |
3265 range = 0 - startpos; | |
3265 else if (endpos > total_size) | 3266 else if (endpos > total_size) |
3266 range = total_size - startpos; | 3267 range = total_size - startpos; |
3267 | 3268 |
3268 /* If the search isn't to be a backwards one, don't waste time in a | 3269 /* If the search isn't to be a backwards one, don't waste time in a |
3269 search for a pattern that must be anchored. */ | 3270 search for a pattern that must be anchored. */ |