Merge branch 'ew/hashmap'
Code clean-up of the hashmap API, both users and implementation. * ew/hashmap: hashmap_entry: remove first member requirement from docs hashmap: remove type arg from hashmap_{get,put,remove}_entry OFFSETOF_VAR macro to simplify hashmap iterators hashmap: introduce hashmap_free_entries hashmap: hashmap_{put,remove} return hashmap_entry * hashmap: use *_entry APIs for iteration hashmap_cmp_fn takes hashmap_entry params hashmap_get{,_from_hash} return "struct hashmap_entry *" hashmap: use *_entry APIs to wrap container_of hashmap_get_next returns "struct hashmap_entry *" introduce container_of macro hashmap_put takes "struct hashmap_entry *" hashmap_remove takes "const struct hashmap_entry *" hashmap_get takes "const struct hashmap_entry *" hashmap_add takes "struct hashmap_entry *" hashmap_get_next takes "const struct hashmap_entry *" hashmap_entry_init takes "struct hashmap_entry *" packfile: use hashmap_entry in delta_base_cache_entry coccicheck: detect hashmap_entry.hash assignment diff: use hashmap_entry_init on moved_entry.ent
This commit is contained in:
16
contrib/coccinelle/hashmap.cocci
Normal file
16
contrib/coccinelle/hashmap.cocci
Normal file
@ -0,0 +1,16 @@
|
||||
@ hashmap_entry_init_usage @
|
||||
expression E;
|
||||
struct hashmap_entry HME;
|
||||
@@
|
||||
- HME.hash = E;
|
||||
+ hashmap_entry_init(&HME, E);
|
||||
|
||||
@@
|
||||
identifier f !~ "^hashmap_entry_init$";
|
||||
expression E;
|
||||
struct hashmap_entry *HMEP;
|
||||
@@
|
||||
f(...) {<...
|
||||
- HMEP->hash = E;
|
||||
+ hashmap_entry_init(HMEP, E);
|
||||
...>}
|
Reference in New Issue
Block a user