Skip to content

Commit c7b189b

Browse files
committed
sha1: refactor folder structure
Eliminate the `sha1` folder, move it down into `hash` so that future impelmentations can share common code.
1 parent 8bc998f commit c7b189b

File tree

17 files changed

+31
-29
lines changed

17 files changed

+31
-29
lines changed

src/util/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(UTIL_INCLUDES
99
"${PROJECT_SOURCE_DIR}/src/util"
1010
"${PROJECT_SOURCE_DIR}/include")
1111

12-
file(GLOB UTIL_SRC *.c *.h allocators/*.c allocators/*.h hash/sha1.h)
12+
file(GLOB UTIL_SRC *.c *.h allocators/*.c allocators/*.h hash.h)
1313
list(SORT UTIL_SRC)
1414

1515
#
@@ -29,18 +29,18 @@ endif()
2929
#
3030

3131
if(USE_SHA1 STREQUAL "CollisionDetection")
32-
file(GLOB UTIL_SRC_HASH hash/sha1/collisiondetect.* hash/sha1/sha1dc/*)
32+
file(GLOB UTIL_SRC_HASH hash/collisiondetect.* hash/sha1dc/*)
3333
target_compile_definitions(util PRIVATE SHA1DC_NO_STANDARD_INCLUDES=1)
3434
target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_SHA1_C=\"git2_util.h\")
3535
target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"git2_util.h\")
3636
elseif(USE_SHA1 STREQUAL "OpenSSL")
37-
file(GLOB UTIL_SRC_HASH hash/sha1/openssl.*)
37+
file(GLOB UTIL_SRC_HASH hash/openssl.*)
3838
elseif(USE_SHA1 STREQUAL "CommonCrypto")
39-
file(GLOB UTIL_SRC_HASH hash/sha1/common_crypto.*)
39+
file(GLOB UTIL_SRC_HASH hash/common_crypto.*)
4040
elseif(USE_SHA1 STREQUAL "mbedTLS")
41-
file(GLOB UTIL_SRC_HASH hash/sha1/mbedtls.*)
41+
file(GLOB UTIL_SRC_HASH hash/mbedtls.*)
4242
elseif(USE_SHA1 STREQUAL "Win32")
43-
file(GLOB UTIL_SRC_HASH hash/sha1/win32.*)
43+
file(GLOB UTIL_SRC_HASH hash/win32.*)
4444
else()
4545
message(FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1}")
4646
endif()

src/util/hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#include "git2_util.h"
1212

13-
#include "hash/sha1.h"
13+
#include "hash/sha.h"
1414

1515
typedef struct {
1616
void *data;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* a Linking Exception. For full terms see the included COPYING file.
66
*/
77

8-
#ifndef INCLUDE_hash_sha1_collisiondetect_h__
9-
#define INCLUDE_hash_sha1_collisiondetect_h__
8+
#ifndef INCLUDE_hash_collisiondetect_h__
9+
#define INCLUDE_hash_collisiondetect_h__
1010

11-
#include "hash/sha1.h"
11+
#include "hash/sha.h"
1212

1313
#include "sha1dc/sha1.h"
1414

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* a Linking Exception. For full terms see the included COPYING file.
66
*/
77

8-
#ifndef INCLUDE_hash_sha1_common_crypto_h__
9-
#define INCLUDE_hash_sha1_common_crypto_h__
8+
#ifndef INCLUDE_hash_common_crypto_h__
9+
#define INCLUDE_hash_common_crypto_h__
1010

11-
#include "hash/sha1.h"
11+
#include "hash/sha.h"
1212

1313
#include <CommonCrypto/CommonDigest.h>
1414

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* a Linking Exception. For full terms see the included COPYING file.
66
*/
77

8-
#ifndef INCLUDE_hash_sha1_mbedtls_h__
9-
#define INCLUDE_hash_sha1_mbedtls_h__
8+
#ifndef INCLUDE_hash_mbedtls_h__
9+
#define INCLUDE_hash_mbedtls_h__
1010

11-
#include "hash/sha1.h"
11+
#include "hash/sha.h"
1212

1313
#include <mbedtls/sha1.h>
1414

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* a Linking Exception. For full terms see the included COPYING file.
66
*/
77

8-
#ifndef INCLUDE_hash_sha1_openssl_h__
9-
#define INCLUDE_hash_sha1_openssl_h__
8+
#ifndef INCLUDE_hash_openssl_h__
9+
#define INCLUDE_hash_openssl_h__
1010

11-
#include "hash/sha1.h"
11+
#include "hash/sha.h"
1212

1313
#include <openssl/sha.h>
1414

0 commit comments

Comments
 (0)