{"thread":{"id":"44383","subject":"[PATCH] git-compat-util: move content inside ifdef/endif guards","startedAt":"2016-10-27T17:30:37Z","lastAt":"2016-10-27T17:37:22Z","messageCount":2,"participants":["Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"304974","messageId":"20161027173029.bu233oiekpfoh6lw@sigill.intra.peff.net","threadId":"44383","inReplyTo":null,"subject":"[PATCH] git-compat-util: move content inside ifdef/endif guards","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-10-27T17:30:30Z","receivedAt":"2016-10-27T17:30:37Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Commit 3f2e2297b9 (add an extra level of indirection to\nmain(), 2016-07-01) added a declaration to git-compat-util.h,\nbut it was accidentally placed after the final #endif that\nguards against multiple inclusions.\n\nThis doesn't have any actual impact on the code, since it's\nnot incorrect to repeat a function declaration in C. But\nit's a bad habit, and makes it more likely for somebody else\nto make the same mistake. It also defeats gcc's optimization\nto avoid opening header files whose contents are completely\nguarded.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nI just happened to notice this today while doing something unrelated in\nthe file.\n\n git-compat-util.h | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 91e366d1dd..771ea29f31 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -1042,6 +1042,6 @@ struct tm *git_gmtime_r(const time_t *, struct tm *);\n #define getc_unlocked(fh) getc(fh)\n #endif\n \n-#endif\n-\n extern int cmd_main(int, const char **);\n+\n+#endif\n-- \n2.10.1.916.g0d2035c\n"},{"id":"304975","messageId":"xmqq8tt97kxi.fsf@gitster.mtv.corp.google.com","threadId":"44383","inReplyTo":"20161027173029.bu233oiekpfoh6lw@sigill.intra.peff.net","subject":"Re: [PATCH] git-compat-util: move content inside ifdef/endif guards","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-10-27T17:37:13Z","receivedAt":"2016-10-27T17:37:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> Commit 3f2e2297b9 (add an extra level of indirection to\n> main(), 2016-07-01) added a declaration to git-compat-util.h,\n> but it was accidentally placed after the final #endif that\n> guards against multiple inclusions.\n>\n> This doesn't have any actual impact on the code, since it's\n> not incorrect to repeat a function declaration in C. But\n> it's a bad habit, and makes it more likely for somebody else\n> to make the same mistake. It also defeats gcc's optimization\n> to avoid opening header files whose contents are completely\n> guarded.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> I just happened to notice this today while doing something unrelated in\n> the file.\n\nThanks.\n\n>\n>  git-compat-util.h | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index 91e366d1dd..771ea29f31 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -1042,6 +1042,6 @@ struct tm *git_gmtime_r(const time_t *, struct tm *);\n>  #define getc_unlocked(fh) getc(fh)\n>  #endif\n>  \n> -#endif\n> -\n>  extern int cmd_main(int, const char **);\n> +\n> +#endif\n"}]}