Use the newly introduced strbuf_split_str_omit_term() rather than
using strbuf_split_str() and manually removing the ',' terminator.

Helped-by: Eric Sunshine <sunsh...@sunshineco.com>
Signed-off-by: Karthik Nayak <karthik....@gmail.com>
---
 ref-filter.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/ref-filter.c b/ref-filter.c
index f097176..38f38d4 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -892,18 +892,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.7.0

--
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