[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 41509d8 1/2: * Short eln filename hashes
From: |
Andrea Corallo |
Subject: |
feature/native-comp 41509d8 1/2: * Short eln filename hashes |
Date: |
Wed, 3 Feb 2021 15:26:22 -0500 (EST) |
branch: feature/native-comp
commit 41509d873e8a05aa98133cb78f384e06e69779ab
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
* Short eln filename hashes
* src/comp.c (HASH_LENGTH): New macro.
(comp_hash_string, comp_hash_source_file): Trim the hash before
returning.
---
src/comp.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/comp.c b/src/comp.c
index b5adc3e..1b346f8 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -413,6 +413,9 @@ load_gccjit_if_necessary (bool mandatory)
/* Increase this number to force a new Vcomp_abi_hash to be generated. */
#define ABI_VERSION "1"
+/* Length of the hashes used for eln file naming. */
+#define HASH_LENGTH 8
+
/* C symbols emitted for the load relocation mechanism. */
#define CURRENT_THREAD_RELOC_SYM "current_thread_reloc"
#define PURE_RELOC_SYM "pure_reloc"
@@ -662,7 +665,7 @@ comp_hash_string (Lisp_Object string)
md5_buffer (SSDATA (string), SCHARS (string), SSDATA (digest));
hexbuf_digest (SSDATA (digest), SDATA (digest), MD5_DIGEST_SIZE);
- return digest;
+ return Fsubstring (digest, Qnil, make_fixnum (HASH_LENGTH));
}
static Lisp_Object
@@ -688,7 +691,7 @@ comp_hash_source_file (Lisp_Object filename)
hexbuf_digest (SSDATA (digest), SSDATA (digest), MD5_DIGEST_SIZE);
- return digest;
+ return Fsubstring (digest, Qnil, make_fixnum (HASH_LENGTH));
}
/* Produce a key hashing Vcomp_subr_list. */