Code

branch: clean up repeated strlen
authorJeff King <peff@peff.net>
Thu, 19 Feb 2009 03:35:45 +0000 (22:35 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 19 Feb 2009 03:59:16 +0000 (19:59 -0800)
Commit 45e2b61 fixed the initialization of a "len" struct
parameter via strlen. We can use that to clean up what is
now 3 strlens in a 6-line sequence.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-branch.c

index 6106a1abd5d5a001a44d06a66bc0ea2e47f5247d..b15d3517f338477e6a7014cf4373914e2c962d64 100644 (file)
@@ -436,8 +436,8 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev, str
                item.kind = REF_LOCAL_BRANCH;
                item.dest = NULL;
                item.commit = head_commit;
-               if (strlen(item.name) > ref_list.maxwidth)
-                       ref_list.maxwidth = strlen(item.name);
+               if (item.len > ref_list.maxwidth)
+                       ref_list.maxwidth = item.len;
                print_ref_item(&item, ref_list.maxwidth, verbose, abbrev, 1, "");
                free(item.name);
        }