git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] help: ensure that common-cmds.h is only included by help.c
@ 2014-09-14  1:11 David Aguilar
  2014-09-14  2:00 ` Perry Hutchison
  0 siblings, 1 reply; 6+ messages in thread
From: David Aguilar @ 2014-09-14  1:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Add a #ifndef guard to ensure that common-cmds.h can only
be included by help.c.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
 generate-cmdlist.sh | 4 ++++
 help.c              | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
index 9a4c9b9..99cd140 100755
--- a/generate-cmdlist.sh
+++ b/generate-cmdlist.sh
@@ -1,6 +1,10 @@
 #!/bin/sh
 
 echo "/* Automatically generated by $0 */
+#ifndef GIT_HELP_INTERNAL
+#error \"common-cmds.h can only be included by help.c\"
+#endif
+
 struct cmdname_help {
     char name[16];
     char help[80];
diff --git a/help.c b/help.c
index 7af65e2..abf1689 100644
--- a/help.c
+++ b/help.c
@@ -3,11 +3,12 @@
 #include "exec_cmd.h"
 #include "levenshtein.h"
 #include "help.h"
-#include "common-cmds.h"
 #include "string-list.h"
 #include "column.h"
 #include "version.h"
 #include "refs.h"
+#define GIT_HELP_INTERNAL
+#include "common-cmds.h"
 
 void add_cmdname(struct cmdnames *cmds, const char *name, int len)
 {
-- 
2.1.0.241.ga16d620

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-09-14  8:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-14  1:11 [PATCH] help: ensure that common-cmds.h is only included by help.c David Aguilar
2014-09-14  2:00 ` Perry Hutchison
2014-09-14  5:23   ` Junio C Hamano
2014-09-14  7:35     ` David Aguilar
2014-09-14  7:55     ` Perry Hutchison
2014-09-14  8:44       ` David Aguilar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).