git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] use strbuf_addbuf for adding strbufs

From
René Scharfe <l.s.r@web.de>
Date
Jul 10, 2014, 08:52 UTC
Message-ID
<53BE5445.20401@web.de>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 builtin/log.c | 2 +-
 pretty.c      | 2 +-
 rerere.c      | 4 ++--
 sha1_name.c   | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/log.c b/builtin/log.c
index 27c1b65..4389722 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -861,7 +861,7 @@ static void add_branch_description(struct strbuf *buf, const char *branch_name)
 	read_branch_desc(&desc, branch_name);
 	if (desc.len) {
 		strbuf_addch(buf, '\n');
-		strbuf_add(buf, desc.buf, desc.len);
+		strbuf_addbuf(buf, &desc);
 		strbuf_addch(buf, '\n');
 	}
 }
diff --git a/pretty.c b/pretty.c
index 8d201f6..6e54934 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1376,7 +1376,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
 		case trunc_none:
 			break;
 		}
-		strbuf_addstr(sb, local_sb.buf);
+		strbuf_addbuf(sb, &local_sb);
 	} else {
 		int sb_len = sb->len, offset = 0;
 		if (c->flush_type == flush_left)
diff --git a/rerere.c b/rerere.c
index d55aa8a..04d923d 100644
--- a/rerere.c
+++ b/rerere.c
@@ -207,11 +207,11 @@ static int handle_path(unsigned char *sha1, struct rerere_io *io, int marker_siz
 			strbuf_reset(&one);
 			strbuf_reset(&two);
 		} else if (hunk == RR_SIDE_1)
-			strbuf_addstr(&one, buf.buf);
+			strbuf_addbuf(&one, &buf);
 		else if (hunk == RR_ORIGINAL)
 			; /* discard */
 		else if (hunk == RR_SIDE_2)
-			strbuf_addstr(&two, buf.buf);
+			strbuf_addbuf(&two, &buf);
 		else
 			rerere_io_putstr(buf.buf, io);
 		continue;
diff --git a/sha1_name.c b/sha1_name.c
index 5bfa841..6ccd3a5 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -946,7 +946,7 @@ static int interpret_nth_prior_checkout(const char *name, int namelen,
 	retval = 0;
 	if (0 < for_each_reflog_ent_reverse("HEAD", grab_nth_branch_switch, &cb)) {
 		strbuf_reset(buf);
-		strbuf_add(buf, cb.buf.buf, cb.buf.len);
+		strbuf_addbuf(buf, &cb.buf);
 		retval = brace - name + 1;
 	}
 
-- 
2.0.0
Message 1 of 1 in “use strbuf_addbuf for adding strbufs”
  1. use strbuf_addbuf for adding strbufsRené Scharfe, Jul 10, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.