[PATCH v2 00/19] add strbuf_set operations
- From
Jeremiah Mahler <jmmahler@gmail.com>
- Date
- Jun 9, 2014, 22:19 UTC
- Message-ID
- <cover.1402348696.git.jmmahler@gmail.com>
Version 2 of the patch set to add strbuf_set operations.
Includes suggestions from Eric Sunshine [1]:
- New operations and their documentation placed in one patch.
- Less ambiguous documentation: "Replace the buffer content with [...]"
- Use imperative mood in log messages.
- Don't use strbuf_set operations in cases where strbuf_add is used to
build up a buffer in multiple steps. Multiple adds suggest that
re-ordering is possible whereas a strbuf_set at the beginning
suggests that it isn't. This is confusing.Using strbuf_set before a sequence of adds can be confusing. But using strbuf_add when nothing important was being added to can also be confusing. strbuf_set can be used to make these cases more clear.
struct strbuf mybuf = STRBUF_INIT;
strbuf_add(&mybuf, ...); /* Was something there before? */
strbuf_set(&mybuf, ...); /* Replace everything. */
Several single line replacements were made for this reason.
Additional files have also been converted compared to version 1 [1].
[1]: http://marc.info/?l=git&m=140230874124060&w=2
Jeremiah Mahler (19): add strbuf_set operations sha1_name: simplify via strbuf_set() fast-import: simplify via strbuf_set() builtin/remote: simplify via strbuf_set() branch: simplify via strbuf_set() builtin/branch: simplify via strbuf_set() builtin/checkout: simplify via strbuf_set() builtin/mailinfo: simplify via strbuf_set() builtin/tag: simplify via strbuf_set() date: simplify via strbuf_set() diffcore-order: simplify via strbuf_set() http-backend: simplify via strbuf_set() http: simplify via strbuf_set() ident: simplify via strbuf_set() remote-curl: simplify via strbuf_set() submodule: simplify via strbuf_set() transport: simplify via strbuf_set() vcs-svn/svndump: simplify via strbuf_set() wt-status: simplify via strbuf_set()
Documentation/technical/api-strbuf.txt | 18 +++++++++++ branch.c | 6 ++-- builtin/branch.c | 3 +- builtin/checkout.c | 18 ++++------- builtin/mailinfo.c | 18 ++++------- builtin/remote.c | 59 ++++++++++++---------------------- builtin/tag.c | 3 +- date.c | 3 +- diffcore-order.c | 3 +- fast-import.c | 6 ++-- http-backend.c | 6 ++-- http.c | 3 +- ident.c | 6 ++-- remote-curl.c | 3 +- sha1_name.c | 15 +++------ strbuf.c | 21 ++++++++++++ strbuf.h | 14 ++++++++ submodule.c | 5 ++- transport.c | 3 +- vcs-svn/svndump.c | 3 +- wt-status.c | 3 +- 21 files changed, 110 insertions(+), 109 deletions(-)
-- 2.0.0.592.gf55b190