{"thread":{"id":"38626","subject":"[PATCH] pretty: use starts_with() to check for a prefix","startedAt":"2015-02-21T19:53:09Z","lastAt":"2015-02-21T19:53:09Z","messageCount":1,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"256476","messageId":"54E8E225.4070406@web.de","threadId":"38626","inReplyTo":null,"subject":"[PATCH] pretty: use starts_with() to check for a prefix","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2015-02-21T19:53:09Z","receivedAt":"2015-02-21T19:53:09Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Simplify the code and avoid duplication by using starts_with() instead\nof strlen() and strncmp() to check if a line starts with \"encoding \".\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n pretty.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/pretty.c b/pretty.c\nindex 9d34d02..7b49304 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -567,7 +567,7 @@ static char *replace_encoding_header(char *buf, const char *encoding)\n \tchar *cp = buf;\n \n \t/* guess if there is an encoding header before a \\n\\n */\n-\twhile (strncmp(cp, \"encoding \", strlen(\"encoding \"))) {\n+\twhile (!starts_with(cp, \"encoding \")) {\n \t\tcp = strchr(cp, '\\n');\n \t\tif (!cp || *++cp == '\\n')\n \t\t\treturn buf;\n-- \n2.3.0\n"}]}