Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2023-05-16 09:34:05 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-21 23:39:54 +0300
commit8043418b77a0942cd3291f2bca56a0263b6d9967 (patch)
treede73949bb9bfd3ff5e6b1f8ddd4ec7ff11ec1c68 /object-store.h
parent6723899932eb5b6436e9bac65ffc9b6e644c7fee (diff)
khash: name the structs that khash declares
khash.h lets you instantiate custom hash types that map between two types. These are defined as a struct, as you might expect, and khash typedef's that to kh_foo_t. But it declares the struct anonymously, which doesn't give a name to the struct type itself; there is no "struct kh_foo". This has two small downsides: - when using khash, we declare "kh_foo_t *the_foo". This is unlike our usual naming style, which is "struct kh_foo *the_foo". - you can't forward-declare a typedef of an unnamed struct type in C. So we might do something like this in a header file: struct kh_foo; struct bar { struct kh_foo *the_foo; }; to avoid having to include the header that defines the real kh_foo. But that doesn't work with the typedef'd name. Without the "struct" keyword, the compiler doesn't know we mean that kh_foo is a type. So let's always give khash structs the name that matches our conventions ("struct kh_foo" to match "kh_foo_t"). We'll keep doing the typedef to retain compatibility with existing callers. Co-authored-by: Jeff King <peff@peff.net> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-store.h')
-rw-r--r--object-store.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/object-store.h b/object-store.h
index 12415e5ea7..05803a03e9 100644
--- a/object-store.h
+++ b/object-store.h
@@ -164,7 +164,7 @@ struct raw_object_store {
*/
struct object_directory *odb;
struct object_directory **odb_tail;
- kh_odb_path_map_t *odb_by_path;
+ struct kh_odb_path_map *odb_by_path;
int loaded_alternates;