Switch to needle/haystack names for clarity

"str" and "abbrev" are not as clear as "haystack" and "needle",
respectively, so let's switch to the latter.

I'm doing this just inside the match.c functions, as this is where the
potential for confusion is most ripe. "abbrev" is still used in some other
places, such as in matcher.c, but there things seem less likely to
confuse, so I am leaving that as-is for now.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Short-circuit if needle can't possibly fit inside haystack

This is a cheap little optimization that prevents us form scanning (or
further recursing) if we're too close to the end of the haystack to
possibly encounter the rest of the needle. As it only applies towards
the end of the string, it's not going to make a huge impact, but every
little bit helps.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Prepare to memoize intermediate recursive results

This commit doesn't actually add memoization yet, but puts the basic
structure in place to do so. This will save us from re-doing a great
deal of work in some pathological edge cases (eg. searching for
"aaaaaaaaaaaa" in a string like "aaaaaaaaaaaaaaaaaaaaaaaaaa").

Related:

  https://wincent.com/issues/2094

Signed-off-by: Wincent Colaiuta <win@wincent.com>