Search through the given text for a match of any member of the given keyword set. Return a pointer to the first character of the matching substring, or NULL if no match is found. If FOUNDLEN is non-NULL store in the referenced location the length of the matching substring. Similarly, if FOUNDIDX is non-NULL, store in the referenced location the index number of the particular k
| 786 | in the referenced location the index number of the particular |
| 787 | keyword matched. */ |
| 788 | size_t |
| 789 | kwsexec (kwset_t kws, char const *text, size_t size, |
| 790 | struct kwsmatch *kwsmatch) |
| 791 | { |
| 792 | struct kwset const *kwset = (struct kwset *) kws; |
| 793 | if (kwset->words == 1 && kwset->trans == NULL) |
| 794 | { |
| 795 | size_t ret = bmexec (kws, text, size); |
| 796 | if (kwsmatch != NULL && ret != (size_t) -1) |
| 797 | { |
| 798 | kwsmatch->index = 0; |
| 799 | kwsmatch->offset[0] = ret; |
| 800 | kwsmatch->size[0] = kwset->mind; |
| 801 | } |
| 802 | return ret; |
| 803 | } |
| 804 | else |
| 805 | return cwexec(kws, text, size, kwsmatch); |
| 806 | } |
| 807 | |
| 808 | /* Free the components of the given keyword set. */ |
| 809 | void |