[PATCH] help: ensure that common-cmds.h is only included by help.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Suggested-by: Junio C Hamano <gitster@xxxxxxxxx>
Signed-off-by: David Aguilar <davvid@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]