- Timestamp:
- Jul 24, 2009, 12:59:23 AM (16 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 64c9165
- Parents:
- ab225e0
- git-author:
- Anders Kaseorg <andersk@mit.edu> (07/24/09 00:51:10)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (07/24/09 00:59:23)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
regex.c
rd43edd2 r41c9a96 46 46 } 47 47 48 int owl_regex_compare(owl_regex *re, char *string )48 int owl_regex_compare(owl_regex *re, char *string, int *start, int *end) 49 49 { 50 50 int out, ret; 51 regmatch_t match; 51 52 52 53 /* if the regex is not set we match */ … … 55 56 } 56 57 57 ret=regexec(&(re->re), string, 0, NULL, 0);58 ret=regexec(&(re->re), string, 1, &match, 0); 58 59 out=ret; 59 60 if (re->negate) { 60 61 out=!out; 62 match.rm_so = 0; 63 match.rm_eo = strlen(string); 61 64 } 65 if (start != NULL) *start = match.rm_so; 66 if (end != NULL) *end = match.rm_eo; 62 67 return(out); 63 68 } … … 76 81 void owl_regex_copy(owl_regex *a, owl_regex *b) 77 82 { 78 b->negate=a->negate; 79 b->string=owl_strdup(a->string); 80 memcpy(&(b->re), &(a->re), sizeof(regex_t)); 83 owl_regex_create(b, a->string); 81 84 } 82 85
Note: See TracChangeset
for help on using the changeset viewer.