strbuf_branchname: drop return value
authorJeff King <peff@peff.net>
Thu, 2 Mar 2017 08:21:27 +0000 (03:21 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Mar 2017 19:05:04 +0000 (11:05 -0800)
The return value from strbuf_branchname() is confusing and
useless: it's 0 if the whole name was consumed by an @-mark,
but otherwise is the length of the original name we fed.

No callers actually look at the return value, so let's just
get rid of it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c
strbuf.h
index 28865b3a1fdd3006631e8bcbb8c175f1db296bb6..4c1e91184b9b4618ed3d68634e15fc4541dcc4cc 100644 (file)
@@ -1279,17 +1279,14 @@ int interpret_branch_name(const char *name, int namelen, struct strbuf *buf)
        return -1;
 }
 
-int strbuf_branchname(struct strbuf *sb, const char *name)
+void strbuf_branchname(struct strbuf *sb, const char *name)
 {
        int len = strlen(name);
        int used = interpret_branch_name(name, len, sb);
 
-       if (used == len)
-               return 0;
        if (used < 0)
                used = 0;
        strbuf_add(sb, name + used, len - used);
-       return len;
 }
 
 int strbuf_check_branch_ref(struct strbuf *sb, const char *name)
index 2262b12683b5d91d536baa0b71094098872200d1..3bcde39183d75e3bba99a68f686e60e9bfc40176 100644 (file)
--- a/strbuf.h
+++ b/strbuf.h
@@ -562,7 +562,7 @@ static inline void strbuf_complete_line(struct strbuf *sb)
        strbuf_complete(sb, '\n');
 }
 
-extern int strbuf_branchname(struct strbuf *sb, const char *name);
+extern void strbuf_branchname(struct strbuf *sb, const char *name);
 extern int strbuf_check_branch_ref(struct strbuf *sb, const char *name);
 
 extern void strbuf_addstr_urlencode(struct strbuf *, const char *,