Simplify cases where a strbuf_reset is immediately followed by a
strbuf_add by using strbuf_set operations.

Signed-off-by: Jeremiah Mahler <jmmah...@gmail.com>
---
 date.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/date.c b/date.c
index 782de95..0b723a4 100644
--- a/date.c
+++ b/date.c
@@ -166,8 +166,7 @@ const char *show_date(unsigned long time, int tz, enum 
date_mode mode)
        static struct strbuf timebuf = STRBUF_INIT;
 
        if (mode == DATE_RAW) {
-               strbuf_reset(&timebuf);
-               strbuf_addf(&timebuf, "%lu %+05d", time, tz);
+               strbuf_setf(&timebuf, "%lu %+05d", time, tz);
                return timebuf.buf;
        }
 
-- 
2.0.0.592.gf55b190

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to