Skip to content

Commit 45a574e

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 28dc98e commit 45a574e

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

sha1dc/sha1.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
* https://opensource.org/licenses/MIT
66
***/
77

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"
1511

1612

1713
/*

sha1dc/sha1.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
* See accompanying file LICENSE.txt or copy at
55
* https://opensource.org/licenses/MIT
66
***/
7+
#ifndef SHA1DC_SHA1_H
8+
#define SHA1DC_SHA1_H
79

810
#if defined(__cplusplus)
911
extern "C" {
1012
#endif
1113

12-
#include <stdint.h>
13-
1414
/* uses SHA-1 message expansion to expand the first 16 words of W[] to 80 words */
1515
/* void sha1_message_expansion(uint32_t W[80]); */
1616

@@ -103,3 +103,5 @@ int SHA1DCFinal(unsigned char[20], SHA1_CTX*);
103103
#if defined(__cplusplus)
104104
}
105105
#endif
106+
107+
#endif /* SHA1DC_SHA1_H */

sha1dc/ubc_check.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
// ubc_check has been verified against ubc_check_verify using the 'ubc_check_test' program in the tools section
2525
*/
2626

27-
#include <stdint.h>
28-
#include "ubc_check.h"
27+
#include "git-compat-util.h"
28+
#include "sha1dc/ubc_check.h"
2929

3030
static const uint32_t DV_I_43_0_bit = (uint32_t)(1) << 0;
3131
static const uint32_t DV_I_44_0_bit = (uint32_t)(1) << 1;

sha1dc/ubc_check.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
extern "C" {
2828
#endif
2929

30-
#include <stdint.h>
31-
3230
#define DVMASKSIZE 1
3331
typedef struct { int dvType; int dvK; int dvB; int testt; int maski; int maskb; uint32_t dm[80]; } dv_info_t;
3432
extern dv_info_t sha1_dvs[];

0 commit comments

Comments
 (0)