{"thread":{"id":"24515","subject":"[PATCH 1/2] log-tree: simplify digit_in_number","startedAt":"2010-07-25T17:43:17Z","lastAt":"2010-07-25T17:43:18Z","messageCount":2,"participants":["Ralf Thielow"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"146306","messageId":"1280079798-4993-1-git-send-email-ralf.thielow@googlemail.com","threadId":"24515","inReplyTo":null,"subject":"[PATCH 1/2] log-tree: simplify digit_in_number","fromName":"Ralf Thielow","fromEmail":"ralf.thielow@googlemail.com","sentAt":"2010-07-25T17:43:17Z","receivedAt":"2010-07-25T17:43:17Z","isPatch":true,"sender":{"key":"ralf.thielow@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1275832?v=4"},"body":"log-tree: simplify digit_in_number\n\nSimplify the algorithm to resolve the digits in a number.\n\nSigned-off-by: Ralf Thielow <ralf.thielow@googlemail.com>\n---\n log-tree.c |   10 ++++------\n 1 files changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex b46ed3b..95a00a4 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -254,12 +254,10 @@ static void append_signoff(struct strbuf *sb, const char *signoff)\n \n static unsigned int digits_in_number(unsigned int number)\n {\n-\tunsigned int i = 10, result = 1;\n-\twhile (i <= number) {\n-\t\ti *= 10;\n-\t\tresult++;\n-\t}\n-\treturn result;\n+\tint digits = 0;\n+\twhile (number /= 10) \n+\t\tdigits++;\n+\treturn digits++;\n }\n \n void get_patch_filename(struct commit *commit, int nr, const char *suffix,\n-- \n1.7.0.4\n"},{"id":"146307","messageId":"1280079798-4993-2-git-send-email-ralf.thielow@googlemail.com","threadId":"24515","inReplyTo":"1280079798-4993-1-git-send-email-ralf.thielow@googlemail.com","subject":"[PATCH 2/2] simplify digit_in_number","fromName":"Ralf Thielow","fromEmail":"ralf.thielow@googlemail.com","sentAt":"2010-07-25T17:43:18Z","receivedAt":"2010-07-25T17:43:18Z","isPatch":true,"sender":{"key":"ralf.thielow@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1275832?v=4"},"body":"tree-log: simplify digit_in_number\n\nSimplify the algorithm to resolve the digits in a number.\n\nSigned-off-by: Ralf Thielow <ralf.thielow@googlemail.com>\n---\n log-tree.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 95a00a4..c2af716 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -254,10 +254,10 @@ static void append_signoff(struct strbuf *sb, const char *signoff)\n \n static unsigned int digits_in_number(unsigned int number)\n {\n-\tint digits = 0;\n+\tint digits = 1;\n \twhile (number /= 10) \n \t\tdigits++;\n-\treturn digits++;\n+\treturn digits;\n }\n \n void get_patch_filename(struct commit *commit, int nr, const char *suffix,\n-- \n1.7.0.4\n"}]}