sha1dc: adjust header includes for git
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Mar 16, 2017 at 18:08 UTC
45a574eec82424ac11c4c5fe117725597309b9c9
4 files changed
+9
-13
sha1dc/sha1.c
+3
-7
@@ -5,13 +5,9 @@
5
* https://opensource.org/licenses/MIT
6
***/
7
8
-#include <string.h>
9
-#include <memory.h>
10
-#include <stdio.h>
11
-#include <stdlib.h>
12
-
13
-#include "sha1.h"
14
-#include "ubc_check.h"
8
+#include "cache.h"
9
+#include "sha1dc/sha1.h"
10
+#include "sha1dc/ubc_check.h"
11
12
13
/*
sha1dc/sha1.h
+4
-2
@@ -4,13 +4,13 @@
4
* See accompanying file LICENSE.txt or copy at
5
* https://opensource.org/licenses/MIT
6
***/
7
+#ifndef SHA1DC_SHA1_H
8
+#define SHA1DC_SHA1_H
9
10
#if defined(__cplusplus)
11
extern "C" {
12
#endif
13
12
-#include <stdint.h>
13
-
14
/* uses SHA-1 message expansion to expand the first 16 words of W[] to 80 words */
15
/* void sha1_message_expansion(uint32_t W[80]); */
16
@@ -103,3 +103,5 @@ int SHA1DCFinal(unsigned char[20], SHA1_CTX*);
103
#if defined(__cplusplus)
104
}
105
#endif
106
+
107
+#endif /* SHA1DC_SHA1_H */
sha1dc/ubc_check.c
+2
-2
@@ -24,8 +24,8 @@
24
// ubc_check has been verified against ubc_check_verify using the 'ubc_check_test' program in the tools section
25
*/
26
27
-#include <stdint.h>
28
-#include "ubc_check.h"
27
+#include "git-compat-util.h"
28
+#include "sha1dc/ubc_check.h"
29
30
static const uint32_t DV_I_43_0_bit = (uint32_t)(1) << 0;
31
static const uint32_t DV_I_44_0_bit = (uint32_t)(1) << 1;
sha1dc/ubc_check.h
-2
@@ -27,8 +27,6 @@
27
extern "C" {
28
#endif
29
30
-#include <stdint.h>
31
-
30
#define DVMASKSIZE 1
31
typedef struct { int dvType; int dvK; int dvB; int testt; int maski; int maskb; uint32_t dm[80]; } dv_info_t;
32
extern dv_info_t sha1_dvs[];