]> git.ipfire.org Git - thirdparty/git.git/commitdiff
hashmap_entry: remove first member requirement from docs
authorEric Wong <e@80x24.org>
Sun, 6 Oct 2019 23:30:43 +0000 (23:30 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Oct 2019 01:20:12 +0000 (10:20 +0900)
Comments stating that "struct hashmap_entry" must be the first
member in a struct are no longer valid.

Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
attr.c
builtin/fetch.c
hashmap.h
merge-recursive.h
ref-filter.c
refs.c
remote.h
sub-process.h
t/helper/test-hashmap.c

diff --git a/attr.c b/attr.c
index 15f0efdf609fcaa9863dff9cad19235aba5ec365..e5c951db69c282177f5792798cc5683cec33d3e8 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -62,7 +62,7 @@ static struct attr_hashmap g_attr_hashmap;
 
 /* The container for objects stored in "struct attr_hashmap" */
 struct attr_hash_entry {
-       struct hashmap_entry ent; /* must be the first member! */
+       struct hashmap_entry ent;
        const char *key; /* the key; memory should be owned by value */
        size_t keylen; /* length of the key */
        void *value; /* the stored value */
index 09f7170616c25de769a9f92d68fa43e92eb6b700..a3154a4edb92fbd5fd2595f4d982d25d33798f3e 100644 (file)
@@ -251,7 +251,7 @@ static int will_fetch(struct ref **head, const unsigned char *sha1)
 }
 
 struct refname_hash_entry {
-       struct hashmap_entry ent; /* must be the first member */
+       struct hashmap_entry ent;
        struct object_id oid;
        int ignore;
        char refname[FLEX_ARRAY];
index bf4a05937d39abc1c07afe4a76f8b79b632e074e..bd2701549f55650748c7cfd5afd2dad6c2321f54 100644 (file)
--- a/hashmap.h
+++ b/hashmap.h
@@ -13,7 +13,7 @@
  *
  * struct hashmap map;
  * struct long2string {
- *     struct hashmap_entry ent; // must be the first member!
+ *     struct hashmap_entry ent;
  *     long key;
  *     char value[FLEX_ARRAY];   // be careful with allocating on stack!
  * };
@@ -141,7 +141,7 @@ static inline unsigned int oidhash(const struct object_id *oid)
 
 /*
  * struct hashmap_entry is an opaque structure representing an entry in the
- * hash table, which must be used as first member of user data structures.
+ * hash table.
  * Ideally it should be followed by an int-sized member to prevent unused
  * memory on 64-bit systems due to alignment.
  */
index c2b7bb65c62ff51af1b89087bbf6692060b5962e..daa742568e03ddde882344a7a8985a740844e150 100644 (file)
@@ -50,7 +50,7 @@ struct merge_options {
  *                       in get_directory_renames() for details
  */
 struct dir_rename_entry {
-       struct hashmap_entry ent; /* must be the first member! */
+       struct hashmap_entry ent;
        char *dir;
        unsigned non_unique_new_dir:1;
        struct strbuf new_dir;
@@ -58,7 +58,7 @@ struct dir_rename_entry {
 };
 
 struct collision_entry {
-       struct hashmap_entry ent; /* must be the first member! */
+       struct hashmap_entry ent;
        char *target_file;
        struct string_list source_files;
        unsigned reported_already:1;
index 0950b789e3990d84da998fe5e6b115f5845ac7a9..5c10a343c6b112e497a3c963f7b3375f84376f00 100644 (file)
@@ -79,7 +79,7 @@ static struct expand_data {
 } oi, oi_deref;
 
 struct ref_to_worktree_entry {
-       struct hashmap_entry ent; /* must be the first member! */
+       struct hashmap_entry ent;
        struct worktree *wt; /* key is wt->head_ref */
 };
 
diff --git a/refs.c b/refs.c
index 2d3eb40f3974aa3eb129f02c8aae3ea49bc2f82c..1ab0bb54d3d73bfe17f0eab4cd02d760bb9a7d01 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -1772,7 +1772,7 @@ int resolve_gitlink_ref(const char *submodule, const char *refname,
 
 struct ref_store_hash_entry
 {
-       struct hashmap_entry ent; /* must be the first member! */
+       struct hashmap_entry ent;
 
        struct ref_store *refs;
 
index 83e885672ba968309c17341b2067f6863acfaaf9..0e1d2b245b655602a9b2ee4e37e43914bc69ec59 100644 (file)
--- a/remote.h
+++ b/remote.h
@@ -14,7 +14,7 @@ enum {
 };
 
 struct remote {
-       struct hashmap_entry ent;  /* must be first */
+       struct hashmap_entry ent;
 
        const char *name;
        int origin, configured_in_repo;
index 0d12708b8cc921a86e83cae6f194dfbaeeea68e4..e85f21fa1a7c2bc59f032b5b2a2cffd6cab771a5 100644 (file)
@@ -24,7 +24,7 @@
 
 /* Members should not be accessed directly. */
 struct subprocess_entry {
-       struct hashmap_entry ent; /* must be the first member! */
+       struct hashmap_entry ent;
        const char *cmd;
        struct child_process process;
 };
index cc577c8956cb494e2ddba1f4a727c835f2b2fb17..f38706216f44c3c881f1d52b250fe74d5140bb37 100644 (file)
@@ -5,6 +5,7 @@
 
 struct test_entry
 {
+       int padding; /* hashmap entry no longer needs to be the first member */
        struct hashmap_entry ent;
        /* key and value as two \0-terminated strings */
        char key[FLEX_ARRAY];