git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Aguilar <davvid@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH] help: ensure that common-cmds.h is only included by help.c
Date: Sat, 13 Sep 2014 18:11:13 -0700	[thread overview]
Message-ID: <1410657073-3089-1-git-send-email-davvid@gmail.com> (raw)

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

             reply	other threads:[~2014-09-14  1:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-14  1:11 David Aguilar [this message]
2014-09-14  2:00 ` [PATCH] help: ensure that common-cmds.h is only included by help.c 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1410657073-3089-1-git-send-email-davvid@gmail.com \
    --to=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).