Changeset 72f613a


Ignore:
Timestamp:
Sep 18, 2010, 3:17:27 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
449c682
Parents:
9c678a5
git-author:
David Benjamin <davidben@mit.edu> (07/31/10 18:07:44)
git-committer:
David Benjamin <davidben@mit.edu> (09/18/10 15:17:27)
Message:
Make owl_fmtext_search take and return an offset
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fmtext.c

    re0022d2 r72f613a  
    620620}
    621621
    622 /* return 1 if the string is found, 0 if not.  This is a case
    623  *  insensitive search.
     622/* Search 'f' for the regex 're' for matches starting at
     623 * 'start'. Returns the offset of the first match, -1 if not
     624 * found. This is a case-insensitive search.
    624625 */
    625 int owl_fmtext_search(const owl_fmtext *f, const owl_regex *re)
    626 {
    627   if (owl_regex_compare(re, f->textbuff, NULL, NULL) == 0) return(1);
    628   return(0);
     626int owl_fmtext_search(const owl_fmtext *f, const owl_regex *re, int start)
     627{
     628  int offset;
     629  if (start > f->textlen ||
     630      owl_regex_compare(re, f->textbuff + start, &offset, NULL) != 0)
     631    return -1;
     632  return offset + start;
    629633}
    630634
  • message.c

    r89ab5c8 r72f613a  
    681681  owl_message_format(m); /* is this necessary? */
    682682 
    683   return (owl_fmtext_search(&(m->fmtext->fmtext), re));
     683  return owl_fmtext_search(&(m->fmtext->fmtext), re, 0) >= 0;
    684684}
    685685
Note: See TracChangeset for help on using the changeset viewer.