Re: [PATCH] Make strbuf_cmp inline, constify its arguments and optimize it a bit

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Timo Hirvonen
Date: Sunday, October 7, 2007 - 7:24 am

Alex Riesen <raa.lkml@gmail.com> wrote:


strbuf->buf is always non-NULL and NUL-terminated so you could just do

static inline int strbuf_cmp(const struct strbuf *a, const struct strbuf *b)
{
	int len = a->len < b->len ? a->len : b->len;
	return memcmp(a->buf, b->buf, len + 1);
}
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
mini-refactor in rerere.c, Pierre Habouzit, (Mon Sep 24, 2:25 am)
[PATCH 1/2] Add strbuf_cmp., Pierre Habouzit, (Mon Sep 24, 2:25 am)
Re: [PATCH 2/2] Make builtin-rerere use of strbuf nicer an ..., Johannes Schindelin, (Mon Sep 24, 3:38 am)
Re: [PATCH] Make strbuf_cmp inline, constify its arguments ..., Timo Hirvonen, (Sun Oct 7, 7:24 am)
Re: [PATCH] Make strbuf_cmp inline, constify its arguments ..., Johannes Schindelin, (Sun Oct 7, 9:11 am)
Re: [PATCH] Make strbuf_cmp inline, constify its arguments ..., Johannes Schindelin, (Sun Oct 7, 11:25 am)