hashmap_entry: remove first member requirement from docs
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>
This commit is contained in:
parent
404ab78e39
commit
e2b5038d87
2
attr.c
2
attr.c
@ -62,7 +62,7 @@ static struct attr_hashmap g_attr_hashmap;
|
|||||||
|
|
||||||
/* The container for objects stored in "struct attr_hashmap" */
|
/* The container for objects stored in "struct attr_hashmap" */
|
||||||
struct attr_hash_entry {
|
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 */
|
const char *key; /* the key; memory should be owned by value */
|
||||||
size_t keylen; /* length of the key */
|
size_t keylen; /* length of the key */
|
||||||
void *value; /* the stored value */
|
void *value; /* the stored value */
|
||||||
|
@ -251,7 +251,7 @@ static int will_fetch(struct ref **head, const unsigned char *sha1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct refname_hash_entry {
|
struct refname_hash_entry {
|
||||||
struct hashmap_entry ent; /* must be the first member */
|
struct hashmap_entry ent;
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
int ignore;
|
int ignore;
|
||||||
char refname[FLEX_ARRAY];
|
char refname[FLEX_ARRAY];
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*
|
*
|
||||||
* struct hashmap map;
|
* struct hashmap map;
|
||||||
* struct long2string {
|
* struct long2string {
|
||||||
* struct hashmap_entry ent; // must be the first member!
|
* struct hashmap_entry ent;
|
||||||
* long key;
|
* long key;
|
||||||
* char value[FLEX_ARRAY]; // be careful with allocating on stack!
|
* 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
|
* 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
|
* Ideally it should be followed by an int-sized member to prevent unused
|
||||||
* memory on 64-bit systems due to alignment.
|
* memory on 64-bit systems due to alignment.
|
||||||
*/
|
*/
|
||||||
|
@ -50,7 +50,7 @@ struct merge_options {
|
|||||||
* in get_directory_renames() for details
|
* in get_directory_renames() for details
|
||||||
*/
|
*/
|
||||||
struct dir_rename_entry {
|
struct dir_rename_entry {
|
||||||
struct hashmap_entry ent; /* must be the first member! */
|
struct hashmap_entry ent;
|
||||||
char *dir;
|
char *dir;
|
||||||
unsigned non_unique_new_dir:1;
|
unsigned non_unique_new_dir:1;
|
||||||
struct strbuf new_dir;
|
struct strbuf new_dir;
|
||||||
@ -58,7 +58,7 @@ struct dir_rename_entry {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct collision_entry {
|
struct collision_entry {
|
||||||
struct hashmap_entry ent; /* must be the first member! */
|
struct hashmap_entry ent;
|
||||||
char *target_file;
|
char *target_file;
|
||||||
struct string_list source_files;
|
struct string_list source_files;
|
||||||
unsigned reported_already:1;
|
unsigned reported_already:1;
|
||||||
|
@ -79,7 +79,7 @@ static struct expand_data {
|
|||||||
} oi, oi_deref;
|
} oi, oi_deref;
|
||||||
|
|
||||||
struct ref_to_worktree_entry {
|
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 */
|
struct worktree *wt; /* key is wt->head_ref */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
2
refs.c
2
refs.c
@ -1772,7 +1772,7 @@ int resolve_gitlink_ref(const char *submodule, const char *refname,
|
|||||||
|
|
||||||
struct ref_store_hash_entry
|
struct ref_store_hash_entry
|
||||||
{
|
{
|
||||||
struct hashmap_entry ent; /* must be the first member! */
|
struct hashmap_entry ent;
|
||||||
|
|
||||||
struct ref_store *refs;
|
struct ref_store *refs;
|
||||||
|
|
||||||
|
2
remote.h
2
remote.h
@ -14,7 +14,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct remote {
|
struct remote {
|
||||||
struct hashmap_entry ent; /* must be first */
|
struct hashmap_entry ent;
|
||||||
|
|
||||||
const char *name;
|
const char *name;
|
||||||
int origin, configured_in_repo;
|
int origin, configured_in_repo;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
/* Members should not be accessed directly. */
|
/* Members should not be accessed directly. */
|
||||||
struct subprocess_entry {
|
struct subprocess_entry {
|
||||||
struct hashmap_entry ent; /* must be the first member! */
|
struct hashmap_entry ent;
|
||||||
const char *cmd;
|
const char *cmd;
|
||||||
struct child_process process;
|
struct child_process process;
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
struct test_entry
|
struct test_entry
|
||||||
{
|
{
|
||||||
|
int padding; /* hashmap entry no longer needs to be the first member */
|
||||||
struct hashmap_entry ent;
|
struct hashmap_entry ent;
|
||||||
/* key and value as two \0-terminated strings */
|
/* key and value as two \0-terminated strings */
|
||||||
char key[FLEX_ARRAY];
|
char key[FLEX_ARRAY];
|
||||||
|
Loading…
Reference in New Issue
Block a user