implement ends_with via strip_suffix
commitf52a35fd63cc6d570083cedc15576d01c0968d98
authorJeff King <peff@peff.net>
Mon, 30 Jun 2014 16:58:08 +0000 (30 12:58 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Jun 2014 20:43:16 +0000 (30 13:43 -0700)
tree39795365e748d106789760a7ef084dc625bd9361
parent35480f0b23f2c1824109ddae24392a70d19c6b9c
implement ends_with via strip_suffix

The ends_with function is essentially a simplified version
of strip_suffix, in which we throw away the stripped length.
Implementing it as an inline on top of strip_suffix has two
advantages:

  1. We save a bit of duplicated code.

  2. The suffix is typically a string literal, and we call
     strlen on it. By making the function inline, many
     compilers can replace the strlen call with a constant.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-compat-util.h
strbuf.c