MCPcopy Create free account
hub / github.com/git/git / kwsexec

Function kwsexec

kwset.c:788–806  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

786 in the referenced location the index number of the particular
787 keyword matched. */
788size_t
789kwsexec (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. */
809void

Callers 1

containsFunction · 0.85

Calls 2

bmexecFunction · 0.85
cwexecFunction · 0.85

Tested by

no test coverage detected