Re: [PATCH 1/9] Add has_extension()
- From
Fredrik Kuivinen <freku045@student.liu.se>
- Date
- Aug 10, 2006, 18:21 UTC
- Message-ID
- <20060810182117.GA13446@c165.ib.student.liu.se>
- In-Reply-To
- <11552221581171-git-send-email-rene.scharfe@lsrfire.ath.cx>
On Thu, Aug 10, 2006 at 05:02:30PM +0200, Rene Scharfe wrote:
Show 6 quoted lines
> +static inline int has_extension(const char *filename, int len, const char *ext)
> +{
> + int extlen = strlen(ext);
> + return len > extlen && !memcmp(filename + len - extlen, ext, extlen);
> +}
> +Wouldn't this function be much easier to use if len is computed from filename with strlen? (after a quick look through the other patches I couldn't find a call site where filename wasn't NUL-terminated)
- Fredrik