From: Jeff King <peff@peff.net>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Subject: [PATCH 2/5] sha1dc: adjust header includes for git
Date: Thu, 16 Mar 2017 18:08:10 -0400 [thread overview]
Message-ID: <20170316220810.orlbvop53fj4g5wg@sigill.intra.peff.net> (raw)
In-Reply-To: <20170316220456.m4yz2kbvzv6waokn@sigill.intra.peff.net>
We can replace system includes with git-compat-util.h or
cache.h (and should make sure it is included first in all C
files). And we can drop includes from headers entirely, as
every C file should include git-compat-util.h itself.
We will add in new include guards around the header files,
though (otherwise you get into trouble including both
sha1dc/sha1.h and cache.h).
And finally, we'll use the full "sha1dc/" path for including
related files. This isn't strictly necessary, but makes the
expected resolution more obvious.
Signed-off-by: Jeff King <peff@peff.net>
---
The cache.h thing is necessary if we want to use sha1_to_hex() later
(which I think we should).
sha1dc/sha1.c | 10 +++-------
sha1dc/sha1.h | 6 ++++--
sha1dc/ubc_check.c | 4 ++--
sha1dc/ubc_check.h | 2 --
4 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c
index 8d12b832b..da516c14c 100644
--- a/sha1dc/sha1.c
+++ b/sha1dc/sha1.c
@@ -5,13 +5,9 @@
* https://opensource.org/licenses/MIT
***/
-#include <string.h>
-#include <memory.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "sha1.h"
-#include "ubc_check.h"
+#include "cache.h"
+#include "sha1dc/sha1.h"
+#include "sha1dc/ubc_check.h"
/*
diff --git a/sha1dc/sha1.h b/sha1dc/sha1.h
index e867724c0..8a5bf0847 100644
--- a/sha1dc/sha1.h
+++ b/sha1dc/sha1.h
@@ -4,13 +4,13 @@
* See accompanying file LICENSE.txt or copy at
* https://opensource.org/licenses/MIT
***/
+#ifndef SHA1DC_SHA1_H
+#define SHA1DC_SHA1_H
#if defined(__cplusplus)
extern "C" {
#endif
-#include <stdint.h>
-
/* uses SHA-1 message expansion to expand the first 16 words of W[] to 80 words */
/* void sha1_message_expansion(uint32_t W[80]); */
@@ -103,3 +103,5 @@ int SHA1DCFinal(unsigned char[20], SHA1_CTX*);
#if defined(__cplusplus)
}
#endif
+
+#endif /* SHA1DC_SHA1_H */
diff --git a/sha1dc/ubc_check.c b/sha1dc/ubc_check.c
index 27d0976da..089dd4743 100644
--- a/sha1dc/ubc_check.c
+++ b/sha1dc/ubc_check.c
@@ -24,8 +24,8 @@
// ubc_check has been verified against ubc_check_verify using the 'ubc_check_test' program in the tools section
*/
-#include <stdint.h>
-#include "ubc_check.h"
+#include "git-compat-util.h"
+#include "sha1dc/ubc_check.h"
static const uint32_t DV_I_43_0_bit = (uint32_t)(1) << 0;
static const uint32_t DV_I_44_0_bit = (uint32_t)(1) << 1;
diff --git a/sha1dc/ubc_check.h b/sha1dc/ubc_check.h
index b349bed92..b64c306d7 100644
--- a/sha1dc/ubc_check.h
+++ b/sha1dc/ubc_check.h
@@ -27,8 +27,6 @@
extern "C" {
#endif
-#include <stdint.h>
-
#define DVMASKSIZE 1
typedef struct { int dvType; int dvK; int dvB; int testt; int maski; int maskb; uint32_t dm[80]; } dv_info_t;
extern dv_info_t sha1_dvs[];
--
2.12.0.623.g86ec6c963
next prev parent reply other threads:[~2017-03-16 22:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-16 20:24 [PATCH 0/2] Re-integrate sha1dc Linus Torvalds
2017-03-16 22:04 ` Jeff King
2017-03-16 22:08 ` Jeff King [this message]
2017-03-16 22:08 ` [PATCH 3/5] sha1dc: disable safe_hash feature Jeff King
2017-03-16 22:09 ` [PATCH 4/5] Makefile: add USE_SHA1DC knob Jeff King
2017-03-16 22:43 ` Junio C Hamano
2017-03-17 0:11 ` Jeff King
2017-03-17 5:24 ` Junio C Hamano
2017-03-17 11:18 ` Jeff King
2017-03-17 17:09 ` [RFC PATCH 0/3] Git integration update for DC-SHA1 Junio C Hamano
2017-03-17 17:09 ` [PATCH 1/3] Makefile: add DC_SHA1 knob Junio C Hamano
2017-03-17 17:09 ` [PATCH 3/3] Makefile: make DC_SHA1 the default Junio C Hamano
2017-03-17 17:41 ` [RFC PATCH 0/3] Git integration update for DC-SHA1 Junio C Hamano
2017-03-17 17:45 ` Jeff King
2017-03-16 22:10 ` [PATCH 0/2] Re-integrate sha1dc Jeff King
2017-03-16 22:23 ` Junio C Hamano
2017-03-17 0:14 ` Jeff King
2017-03-17 5:22 ` Junio C Hamano
2017-03-17 11:22 ` Jeff King
2017-03-16 22:30 ` Linus Torvalds
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170316220810.orlbvop53fj4g5wg@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=torvalds@linux-foundation.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).