* [PATCH] git-compat-util: move content inside ifdef/endif guards
@ 2016-10-27 17:30 Jeff King
2016-10-27 17:37 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Jeff King @ 2016-10-27 17:30 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Commit 3f2e2297b9 (add an extra level of indirection to
main(), 2016-07-01) added a declaration to git-compat-util.h,
but it was accidentally placed after the final #endif that
guards against multiple inclusions.
This doesn't have any actual impact on the code, since it's
not incorrect to repeat a function declaration in C. But
it's a bad habit, and makes it more likely for somebody else
to make the same mistake. It also defeats gcc's optimization
to avoid opening header files whose contents are completely
guarded.
Signed-off-by: Jeff King <peff@peff.net>
---
I just happened to notice this today while doing something unrelated in
the file.
git-compat-util.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index 91e366d1dd..771ea29f31 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1042,6 +1042,6 @@ struct tm *git_gmtime_r(const time_t *, struct tm *);
#define getc_unlocked(fh) getc(fh)
#endif
-#endif
-
extern int cmd_main(int, const char **);
+
+#endif
--
2.10.1.916.g0d2035c
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] git-compat-util: move content inside ifdef/endif guards
2016-10-27 17:30 [PATCH] git-compat-util: move content inside ifdef/endif guards Jeff King
@ 2016-10-27 17:37 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2016-10-27 17:37 UTC (permalink / raw)
To: Jeff King; +Cc: git
Jeff King <peff@peff.net> writes:
> Commit 3f2e2297b9 (add an extra level of indirection to
> main(), 2016-07-01) added a declaration to git-compat-util.h,
> but it was accidentally placed after the final #endif that
> guards against multiple inclusions.
>
> This doesn't have any actual impact on the code, since it's
> not incorrect to repeat a function declaration in C. But
> it's a bad habit, and makes it more likely for somebody else
> to make the same mistake. It also defeats gcc's optimization
> to avoid opening header files whose contents are completely
> guarded.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> I just happened to notice this today while doing something unrelated in
> the file.
Thanks.
>
> git-compat-util.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 91e366d1dd..771ea29f31 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -1042,6 +1042,6 @@ struct tm *git_gmtime_r(const time_t *, struct tm *);
> #define getc_unlocked(fh) getc(fh)
> #endif
>
> -#endif
> -
> extern int cmd_main(int, const char **);
> +
> +#endif
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-27 17:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-27 17:30 [PATCH] git-compat-util: move content inside ifdef/endif guards Jeff King
2016-10-27 17:37 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox