{"thread":{"id":"15691","subject":"Re: [PATCH] for-each-ref: Fix --format=%(subject) for log message without newlines","startedAt":"2008-09-27T22:08:58Z","lastAt":"2008-09-27T22:24:36Z","messageCount":2,"participants":["Nanako Shiraishi","Johan Herland"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"91751","messageId":"20080928070858.6117@nanako3.lavabit.com","threadId":"15691","inReplyTo":null,"subject":"Re: [PATCH] for-each-ref: Fix --format=%(subject) for log message without newlines","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2008-09-27T22:08:58Z","receivedAt":"2008-09-27T22:08:58Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Johan Herland <johan@herland.net> writes:\n\n>  builtin-for-each-ref.c |    4 ++--\n>  1 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c\n> index 9b44092..e59bd80 100644\n> --- a/builtin-for-each-ref.c\n> +++ b/builtin-for-each-ref.c\n> @@ -321,8 +321,8 @@ static const char *find_wholine(const char *who, int wholen, const char *buf, un\n>  static const char *copy_line(const char *buf)\n>  {\n>  \tconst char *eol = strchr(buf, '\\n');\n> -\tif (!eol)\n> -\t\treturn \"\";\n> +\tif (!eol) // simulate strchrnul()\n> +\t\teol = buf + strlen(buf);\n>  \treturn xmemdupz(buf, eol - buf);\n>  }\n\nWhy does this C++ style comment talk about \"simulate\"?\n\nDon't other parts of git already use strchrnul()?\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"91752","messageId":"200809280024.36190.johan@herland.net","threadId":"15691","inReplyTo":"20080928070858.6117@nanako3.lavabit.com","subject":"[PATCH] Use strchrnul() instead of strchr() plus manual workaround","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2008-09-27T22:24:36Z","receivedAt":"2008-09-27T22:24:36Z","isPatch":true,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"Also gets rid of a C++ comment.\n\nSigned-off-by: Johan Herland <johan@herland.net>\n---\n\nOn Sunday 28 September 2008, Nanako Shiraishi wrote:\n> Why does this C++ style comment talk about \"simulate\"?\n>\n> Don't other parts of git already use strchrnul()?\n\nOops. Sorry about that. The man page for strchrnul() says that it is\na GNU extension, so I stayed away from it. Of course, I should have\ngrepped the git source instead...\n\nThis should fix it.\n\n\n...Johan\n\n builtin-for-each-ref.c |    4 +---\n 1 files changed, 1 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c\nindex e59bd80..fa6c1ed 100644\n--- a/builtin-for-each-ref.c\n+++ b/builtin-for-each-ref.c\n@@ -320,9 +320,7 @@ static const char *find_wholine(const char *who, int wholen, const char *buf, un\n \n static const char *copy_line(const char *buf)\n {\n-\tconst char *eol = strchr(buf, '\\n');\n-\tif (!eol) // simulate strchrnul()\n-\t\teol = buf + strlen(buf);\n+\tconst char *eol = strchrnul(buf, '\\n');\n \treturn xmemdupz(buf, eol - buf);\n }\n \n-- \n1.6.0.2.471.g47a76\n"}]}