[PATCH v2 02/11] ref-filter: use strbuf_split_str_omit_term()
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Dec 16, 2015, 15:29 UTC
- Message-ID
- <1450279802-29414-3-git-send-email-Karthik.188@gmail.com>
- In-Reply-To
- <1450279802-29414-1-git-send-email-Karthik.188@gmail.com>
Use the newly introduced strbuf_split_str_omit_term() rather than using strbuf_split_str() and manually removing the ',' terminator.
Signed-off-by: Karthik Nayak <Karthik.188@gmail.com> --- ref-filter.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/ref-filter.c b/ref-filter.c index e205dd2..6263710 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -869,18 +869,11 @@ static void populate_value(struct ref_array_item *ref) if (!valp) die(_("expected format: %%(align:<width>,<position>)")); - /* - * TODO: Implement a function similar to strbuf_split_str() - * which would omit the separator from the end of each value. - */ - s = to_free = strbuf_split_str(valp, ',', 0); + s = to_free = strbuf_split_str_omit_term(valp, ',', 0); align->position = ALIGN_LEFT; while (*s) { - /* Strip trailing comma */ - if (s[1]) - strbuf_setlen(s[0], s[0]->len - 1); if (!strtoul_ui(s[0]->buf, 10, (unsigned int *)&width)) ; else if (!strcmp(s[0]->buf, "left"))
-- 2.6.4