Blender V5.0
BLI_ghash.h File Reference

Go to the source code of this file.

Classes

struct  GHashIterator
struct  GHashIterState
struct  _gh_Entry
struct  GSetIterator
struct  GHashPair

Macros

#define _GHASH_INTERNAL_ATTR
GHash/GSet Macros
#define GHASH_FOREACH_BEGIN(type, var, what)
#define GHASH_FOREACH_END()
#define GSET_FOREACH_BEGIN(type, var, what)
#define GSET_FOREACH_END()

Typedefs

GSet Types

A "set" implementation (unordered collection of unique elements).

Internally this is a 'GHash' without any keys, which is why this API's are in the same header & source file.

typedef struct GSet GSet
typedef GHashHashFP GSetHashFP
typedef GHashCmpFP GSetCmpFP
typedef GHashKeyFreeFP GSetKeyFreeFP
typedef GHashKeyCopyFP GSetKeyCopyFP
typedef GHashIterState GSetIterState

Functions

GHash API

Defined in BLI_ghash.c

GHashBLI_ghash_new_ex (GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GHashBLI_ghash_new (GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GHashBLI_ghash_copy (const GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghash_free (GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void BLI_ghash_reserve (GHash *gh, unsigned int nentries_reserve)
void BLI_ghash_insert (GHash *gh, void *key, void *val)
bool BLI_ghash_reinsert (GHash *gh, void *key, void *val, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void * BLI_ghash_replace_key (GHash *gh, void *key)
void * BLI_ghash_lookup (const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void * BLI_ghash_lookup_default (const GHash *gh, const void *key, void *val_default) ATTR_WARN_UNUSED_RESULT
void ** BLI_ghash_lookup_p (GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_ensure_p (GHash *gh, void *key, void ***r_val) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_ensure_p_ex (GHash *gh, const void *key, void ***r_key, void ***r_val) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_remove (GHash *gh, const void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void BLI_ghash_clear (GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void BLI_ghash_clear_ex (GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp, unsigned int nentries_reserve)
void * BLI_ghash_popkey (GHash *gh, const void *key, GHashKeyFreeFP keyfreefp) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_haskey (const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_pop (GHash *gh, GHashIterState *state, void **r_key, void **r_val) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
unsigned int BLI_ghash_len (const GHash *gh) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_flag_set (GHash *gh, unsigned int flag)
void BLI_ghash_flag_clear (GHash *gh, unsigned int flag)
GSet Public API

Use ghash API to give 'set' functionality

GSetBLI_gset_new_ex (GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GSetBLI_gset_new (GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GSetBLI_gset_copy (const GSet *gs, GSetKeyCopyFP keycopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
unsigned int BLI_gset_len (const GSet *gs) ATTR_WARN_UNUSED_RESULT
void BLI_gset_flag_set (GSet *gs, unsigned int flag)
void BLI_gset_flag_clear (GSet *gs, unsigned int flag)
void BLI_gset_free (GSet *gs, GSetKeyFreeFP keyfreefp)
void BLI_gset_insert (GSet *gs, void *key)
bool BLI_gset_add (GSet *gs, void *key)
bool BLI_gset_ensure_p_ex (GSet *gs, const void *key, void ***r_key)
bool BLI_gset_reinsert (GSet *gs, void *key, GSetKeyFreeFP keyfreefp)
void * BLI_gset_replace_key (GSet *gs, void *key)
bool BLI_gset_haskey (const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT
bool BLI_gset_pop (GSet *gs, GSetIterState *state, void **r_key) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_gset_remove (GSet *gs, const void *key, GSetKeyFreeFP keyfreefp)
void BLI_gset_clear_ex (GSet *gs, GSetKeyFreeFP keyfreefp, unsigned int nentries_reserve)
void BLI_gset_clear (GSet *gs, GSetKeyFreeFP keyfreefp)
void * BLI_gset_lookup (const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT
void * BLI_gset_pop_key (GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT

GHash Iterator

#define _gh_Entry   void
#define GHASH_ITER(gh_iter_, ghash_)
#define GHASH_ITER_INDEX(gh_iter_, ghash_, i_)
GHashIteratorBLI_ghashIterator_new (GHash *gh) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_ghashIterator_init (GHashIterator *ghi, GHash *gh)
void BLI_ghashIterator_free (GHashIterator *ghi)
void BLI_ghashIterator_step (GHashIterator *ghi)
BLI_INLINE void * BLI_ghashIterator_getKey (GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
BLI_INLINE void * BLI_ghashIterator_getValue (GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
BLI_INLINE void ** BLI_ghashIterator_getValue_p (GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
BLI_INLINE bool BLI_ghashIterator_done (const GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT

GSet Iterator

#define GSET_ITER(gs_iter_, gset_)
#define GSET_ITER_INDEX(gs_iter_, gset_, i_)
typedef struct GSetIterator GSetIterator
BLI_INLINE GSetIteratorBLI_gsetIterator_new (GSet *gs)
BLI_INLINE void BLI_gsetIterator_init (GSetIterator *gsi, GSet *gs)
BLI_INLINE void BLI_gsetIterator_free (GSetIterator *gsi)
BLI_INLINE void * BLI_gsetIterator_getKey (GSetIterator *gsi)
BLI_INLINE void BLI_gsetIterator_step (GSetIterator *gsi)
BLI_INLINE bool BLI_gsetIterator_done (const GSetIterator *gsi)

GHash/GSet Utils

Defined in BLI_ghash_utils.cc

#define BLI_ghashutil_strhash(key)
#define BLI_ghashutil_inthash(key)
#define BLI_ghashutil_inthash_v4(key)
#define BLI_ghashutil_inthash_v4_p   ((GSetHashFP)BLI_ghashutil_uinthash_v4)
#define BLI_ghashutil_uinthash_v4_p   ((GSetHashFP)BLI_ghashutil_uinthash_v4)
#define BLI_ghashutil_inthash_v4_murmur(key)
#define BLI_ghashutil_inthash_v4_p_murmur   ((GSetHashFP)BLI_ghashutil_uinthash_v4_murmur)
#define BLI_ghashutil_uinthash_v4_p_murmur   ((GSetHashFP)BLI_ghashutil_uinthash_v4_murmur)
#define BLI_ghashutil_inthash_v4_cmp   BLI_ghashutil_uinthash_v4_cmp
typedef struct GHashPair GHashPair
unsigned int BLI_ghashutil_ptrhash (const void *key)
bool BLI_ghashutil_ptrcmp (const void *a, const void *b)
unsigned int BLI_ghashutil_strhash_n (const char *key, size_t n)
unsigned int BLI_ghashutil_strhash_p (const void *ptr)
unsigned int BLI_ghashutil_strhash_p_murmur (const void *ptr)
bool BLI_ghashutil_strcmp (const void *a, const void *b)
unsigned int BLI_ghashutil_uinthash (unsigned int key)
unsigned int BLI_ghashutil_inthash_p (const void *ptr)
unsigned int BLI_ghashutil_inthash_p_murmur (const void *ptr)
unsigned int BLI_ghashutil_inthash_p_simple (const void *ptr)
bool BLI_ghashutil_intcmp (const void *a, const void *b)
size_t BLI_ghashutil_combine_hash (size_t hash_a, size_t hash_b)
unsigned int BLI_ghashutil_uinthash_v4 (const unsigned int key[4])
unsigned int BLI_ghashutil_uinthash_v4_murmur (const unsigned int key[4])
bool BLI_ghashutil_uinthash_v4_cmp (const void *a, const void *b)
GHashPairBLI_ghashutil_pairalloc (const void *first, const void *second)
unsigned int BLI_ghashutil_pairhash (const void *ptr)
bool BLI_ghashutil_paircmp (const void *a, const void *b)
void BLI_ghashutil_pairfree (void *ptr)
GHashBLI_ghash_ptr_new_ex (const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GHashBLI_ghash_ptr_new (const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GHashBLI_ghash_str_new_ex (const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GHashBLI_ghash_str_new (const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GHashBLI_ghash_int_new_ex (const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GHashBLI_ghash_int_new (const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GHashBLI_ghash_pair_new_ex (const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GHashBLI_ghash_pair_new (const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GSetBLI_gset_ptr_new_ex (const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GSetBLI_gset_ptr_new (const char *info)
GSetBLI_gset_str_new_ex (const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GSetBLI_gset_str_new (const char *info)
GSetBLI_gset_pair_new_ex (const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GSetBLI_gset_pair_new (const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GSetBLI_gset_int_new_ex (const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
GSetBLI_gset_int_new (const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT

GHash Types

enum  { GHASH_FLAG_ALLOW_DUPES = (1 << 0) , GHASH_FLAG_ALLOW_SHRINK = (1 << 1) }
typedef unsigned int(* GHashHashFP) (const void *key)
typedef bool(* GHashCmpFP) (const void *a, const void *b)
typedef void(* GHashKeyFreeFP) (void *key)
typedef void(* GHashValFreeFP) (void *val)
typedef void *(* GHashKeyCopyFP) (const void *key)
typedef void *(* GHashValCopyFP) (const void *val)
typedef struct GHash GHash
typedef struct GHashIterator GHashIterator
typedef struct GHashIterState GHashIterState

Detailed Description

GHash is a hash-map implementation (unordered key, value pairs).

This is also used to implement a 'set' (see GSet below).

Definition in file BLI_ghash.h.

Macro Definition Documentation

◆ _gh_Entry

#define _gh_Entry   void

◆ _GHASH_INTERNAL_ATTR

#define _GHASH_INTERNAL_ATTR

Definition at line 19 of file BLI_ghash.h.

◆ BLI_ghashutil_inthash

#define BLI_ghashutil_inthash ( key)
Value:
(CHECK_TYPE_ANY(&(key), int *, const int *), BLI_ghashutil_uinthash((unsigned int)key))
#define CHECK_TYPE_ANY(...)
unsigned int BLI_ghashutil_uinthash(unsigned int key)

Definition at line 576 of file BLI_ghash.h.

Referenced by blender::ed::object::dupliobject_instancer_hash().

◆ BLI_ghashutil_inthash_v4

#define BLI_ghashutil_inthash_v4 ( key)
Value:
(CHECK_TYPE_ANY(key, int *, const int *), BLI_ghashutil_uinthash_v4((const unsigned int *)key))
unsigned int BLI_ghashutil_uinthash_v4(const unsigned int key[4])

Definition at line 587 of file BLI_ghash.h.

◆ BLI_ghashutil_inthash_v4_cmp

#define BLI_ghashutil_inthash_v4_cmp   BLI_ghashutil_uinthash_v4_cmp

Definition at line 598 of file BLI_ghash.h.

Referenced by BM_mesh_intersect(), and erot_gset_new().

◆ BLI_ghashutil_inthash_v4_murmur

#define BLI_ghashutil_inthash_v4_murmur ( key)
Value:
(CHECK_TYPE_ANY(key, int *, const int *), \
BLI_ghashutil_uinthash_v4_murmur((const unsigned int *)key))

Definition at line 592 of file BLI_ghash.h.

◆ BLI_ghashutil_inthash_v4_p

#define BLI_ghashutil_inthash_v4_p   ((GSetHashFP)BLI_ghashutil_uinthash_v4)

Definition at line 589 of file BLI_ghash.h.

Referenced by BM_mesh_intersect(), and erot_gset_new().

◆ BLI_ghashutil_inthash_v4_p_murmur

#define BLI_ghashutil_inthash_v4_p_murmur   ((GSetHashFP)BLI_ghashutil_uinthash_v4_murmur)

Definition at line 595 of file BLI_ghash.h.

◆ BLI_ghashutil_strhash

#define BLI_ghashutil_strhash ( key)
Value:
(CHECK_TYPE_ANY(key, char *, const char *), BLI_ghashutil_strhash_p(key))
unsigned int BLI_ghashutil_strhash_p(const void *ptr)

Definition at line 570 of file BLI_ghash.h.

Referenced by do_map(), idkey_hash(), and modify_mesh().

◆ BLI_ghashutil_uinthash_v4_p

#define BLI_ghashutil_uinthash_v4_p   ((GSetHashFP)BLI_ghashutil_uinthash_v4)

Definition at line 590 of file BLI_ghash.h.

Referenced by TEST().

◆ BLI_ghashutil_uinthash_v4_p_murmur

#define BLI_ghashutil_uinthash_v4_p_murmur   ((GSetHashFP)BLI_ghashutil_uinthash_v4_murmur)

Definition at line 596 of file BLI_ghash.h.

Referenced by TEST().

◆ GHASH_FOREACH_BEGIN

#define GHASH_FOREACH_BEGIN ( type,
var,
what )
Value:
do { \
GHashIterator gh_iter##var; \
GHASH_ITER (gh_iter##var, what) { \
type var = (type)(BLI_ghashIterator_getValue(&gh_iter##var));
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
Definition BLI_ghash.h:299

Definition at line 520 of file BLI_ghash.h.

◆ GHASH_FOREACH_END

#define GHASH_FOREACH_END ( )
Value:
} \
} \
while (0)

Definition at line 526 of file BLI_ghash.h.

◆ GHASH_ITER

◆ GHASH_ITER_INDEX

#define GHASH_ITER_INDEX ( gh_iter_,
ghash_,
i_ )
Value:
for (BLI_ghashIterator_init(&gh_iter_, ghash_), i_ = 0; \
BLI_ghashIterator_done(&gh_iter_) == false; \
BLI_ghashIterator_step(&gh_iter_), i_++)

Definition at line 322 of file BLI_ghash.h.

Referenced by bm_mesh_region_match_pair(), and wm_gizmomap_select_all_intern().

◆ GSET_FOREACH_BEGIN

#define GSET_FOREACH_BEGIN ( type,
var,
what )
Value:
do { \
GSetIterator gh_iter##var; \
GSET_ITER (gh_iter##var, what) { \
type var = (type)(BLI_gsetIterator_getKey(&gh_iter##var));
BLI_INLINE void * BLI_gsetIterator_getKey(GSetIterator *gsi)
Definition BLI_ghash.h:455

Definition at line 531 of file BLI_ghash.h.

◆ GSET_FOREACH_END

#define GSET_FOREACH_END ( )
Value:
} \
} \
while (0)

Definition at line 537 of file BLI_ghash.h.

◆ GSET_ITER

#define GSET_ITER ( gs_iter_,
gset_ )
Value:
for (BLI_gsetIterator_init(&gs_iter_, gset_); BLI_gsetIterator_done(&gs_iter_) == false; \
BLI_gsetIterator_step(&gs_iter_))
BLI_INLINE bool BLI_gsetIterator_done(const GSetIterator *gsi)
Definition BLI_ghash.h:463
BLI_INLINE void BLI_gsetIterator_init(GSetIterator *gsi, GSet *gs)
Definition BLI_ghash.h:447

Definition at line 468 of file BLI_ghash.h.

Referenced by BM_mesh_intersect(), bmo_grid_fill_exec(), cachefile_handle_free(), blender::ed::transform::recalcData_pose(), similar_edge_select_exec(), similar_face_select_exec(), blender::ed::transform::special_aftertrans_update__pose(), uv_rip_object(), uv_rip_pairs_calc_center_and_direction(), and uv_rip_single_from_loop().

◆ GSET_ITER_INDEX

#define GSET_ITER_INDEX ( gs_iter_,
gset_,
i_ )
Value:
for (BLI_gsetIterator_init(&gs_iter_, gset_), i_ = 0; \
BLI_gsetIterator_done(&gs_iter_) == false; \
BLI_gsetIterator_step(&gs_iter_), i_++)

Definition at line 472 of file BLI_ghash.h.

Referenced by BKE_fcurves_calc_keyed_frames_ex(), and bmo_subdivide_edgering_exec().

Typedef Documentation

◆ GHash

typedef struct GHash GHash

Definition at line 39 of file BLI_ghash.h.

◆ GHashCmpFP

typedef bool(* GHashCmpFP) (const void *a, const void *b)

returns false when equal

Definition at line 33 of file BLI_ghash.h.

◆ GHashHashFP

typedef unsigned int(* GHashHashFP) (const void *key)

Definition at line 31 of file BLI_ghash.h.

◆ GHashIterator

typedef struct GHashIterator GHashIterator

◆ GHashIterState

typedef struct GHashIterState GHashIterState

◆ GHashKeyCopyFP

typedef void *(* GHashKeyCopyFP) (const void *key)

Definition at line 36 of file BLI_ghash.h.

◆ GHashKeyFreeFP

typedef void(* GHashKeyFreeFP) (void *key)

Definition at line 34 of file BLI_ghash.h.

◆ GHashPair

typedef struct GHashPair GHashPair

◆ GHashValCopyFP

typedef void *(* GHashValCopyFP) (const void *val)

Definition at line 37 of file BLI_ghash.h.

◆ GHashValFreeFP

typedef void(* GHashValFreeFP) (void *val)

Definition at line 35 of file BLI_ghash.h.

◆ GSet

typedef struct GSet GSet

Definition at line 337 of file BLI_ghash.h.

◆ GSetCmpFP

Definition at line 340 of file BLI_ghash.h.

◆ GSetHashFP

Definition at line 339 of file BLI_ghash.h.

◆ GSetIterator

typedef struct GSetIterator GSetIterator

Use a GSet specific type so we can cast but compiler sees as different

◆ GSetIterState

Definition at line 344 of file BLI_ghash.h.

◆ GSetKeyCopyFP

Definition at line 342 of file BLI_ghash.h.

◆ GSetKeyFreeFP

Definition at line 341 of file BLI_ghash.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
GHASH_FLAG_ALLOW_DUPES 
GHASH_FLAG_ALLOW_SHRINK 

Definition at line 51 of file BLI_ghash.h.

Function Documentation

◆ BLI_ghash_clear()

◆ BLI_ghash_clear_ex()

void BLI_ghash_clear_ex ( GHash * gh,
GHashKeyFreeFP keyfreefp,
GHashValFreeFP valfreefp,
unsigned int nentries_reserve )

Reset gh clearing all entries.

Parameters
keyfreefpOptional callback to free the key.
valfreefpOptional callback to free the value.
nentries_reserveOptionally reserve the number of members that the hash will hold.

Definition at line 842 of file BLI_ghash.cc.

References BLI_mempool_clear_ex(), GHash::entrypool, ghash_buckets_reset(), and ghash_free_cb().

Referenced by BLI_ghash_clear(), BLI_gset_clear_ex(), collection_gobject_hash_ensure_fix(), and filelist_cache_clear().

◆ BLI_ghash_copy()

GHash * BLI_ghash_copy ( const GHash * gh,
GHashKeyCopyFP keycopyfp,
GHashValCopyFP valcopyfp )

Copy given GHash. Keys and values are also copied if relevant callback is provided, else pointers remain the same.

Definition at line 691 of file BLI_ghash.cc.

References ghash_copy().

Referenced by BKE_vfontdata_copy(), and TEST().

◆ BLI_ghash_ensure_p()

bool BLI_ghash_ensure_p ( GHash * gh,
void * key,
void *** r_val )

Ensure key is exists in gh.

This handles the common situation where the caller needs ensure a key is added to gh, constructing a new value in the case the key isn't found. Otherwise use the existing value.

Such situations typically incur multiple lookups, however this function avoids them by ensuring the key is added, returning a pointer to the value so it can be used or initialized by the caller.

Returns
true when the value didn't need to be added. (when false, the caller must initialize the value).

Definition at line 752 of file BLI_ghash.cc.

References BLI_mempool_alloc(), e, GHash::entrypool, ghash_bucket_index(), ghash_insert_ex_keyonly_entry(), ghash_keyhash(), ghash_lookup_entry_ex(), and hash.

Referenced by BKE_icon_set(), BKE_main_idmap_create(), BKE_main_idmap_insert_id(), BKE_main_relations_create(), bke_view_layer_verify_aov_cb(), bm_face_region_pivot_edge_find(), bm_uidwalk_facestep_begin(), bm_uidwalk_pass_add(), bmo_planar_faces_exec(), bmo_weld_verts_exec(), ccd_build_deflector_hash_single(), collection_gobject_hash_create(), collection_gobject_hash_ensure_fix(), collection_gobject_hash_update_object(), collection_object_add(), blender::ed::object::data_xform_container_item_ensure(), edge_isect_ls_ensure(), ghash_insert_face_edge_link(), ghash_insert_link(), layer_collection_objects_sync(), lib_override_group_tag_data_object_to_collection_init_collection_process(), lib_override_resync_tagging_finalize(), main_relations_create_idlink_cb(), blender::ed::object::make_object_duplilist_real(), blender::ed::transform::mesh_customdatacorrect_init_vert(), modify_mesh(), nlaevalchan_verify(), and view_layer_bases_hash_create().

◆ BLI_ghash_ensure_p_ex()

bool BLI_ghash_ensure_p_ex ( GHash * gh,
const void * key,
void *** r_key,
void *** r_val )

A version of BLI_ghash_ensure_p that allows caller to re-assign the key. Typically used when the key is to be duplicated.

Warning
Caller must write to r_key when returning false.

Definition at line 768 of file BLI_ghash.cc.

References BLI_mempool_alloc(), e, GHash::entrypool, ghash_bucket_index(), ghash_insert_ex_keyonly_entry(), ghash_keyhash(), ghash_lookup_entry_ex(), and hash.

Referenced by BKE_previewimg_cached_ensure(), nlaevalchan_verify_key(), and scene_get_depsgraph_p().

◆ BLI_ghash_flag_clear()

void BLI_ghash_flag_clear ( GHash * gh,
unsigned int flag )

Clear a GHash flag.

Definition at line 877 of file BLI_ghash.cc.

References flag, and GHash::flag.

◆ BLI_ghash_flag_set()

void BLI_ghash_flag_set ( GHash * gh,
unsigned int flag )

Sets a GHash flag.

Definition at line 872 of file BLI_ghash.cc.

References flag, and GHash::flag.

Referenced by BM_mesh_bevel(), TEST(), and TEST().

◆ BLI_ghash_free()

void BLI_ghash_free ( GHash * gh,
GHashKeyFreeFP keyfreefp,
GHashValFreeFP valfreefp )

Frees the GHash and its members.

Parameters
ghThe GHash to free.
keyfreefpOptional callback to free the key.
valfreefpOptional callback to free the value.

Definition at line 860 of file BLI_ghash.cc.

References BLI_assert, BLI_mempool_destroy(), BLI_mempool_len(), GHash::buckets, GHash::entrypool, ghash_free_cb(), MEM_freeN(), and GHash::nentries.

Referenced by armature_dissolve_selected_exec(), BKE_addon_pref_type_free(), BKE_armature_bone_hash_free(), BKE_collection_delete(), BKE_curve_editNurb_keyIndex_free(), BKE_fcurve_pathcache_destroy(), BKE_icons_free(), BKE_keyconfig_pref_type_free(), BKE_lib_override_library_free(), BKE_main_collection_sync_remap(), BKE_main_idmap_destroy(), BKE_main_relations_free(), BKE_nlastrip_validate_name(), BKE_object_defgroup_validmap_get(), BKE_object_material_remap_calc(), BKE_pose_channels_hash_free(), BKE_preview_images_free(), BKE_scene_free_depsgraph_hash(), BKE_scene_undo_depsgraphs_restore(), BKE_sim_debug_data_free(), BKE_vfont_data_free(), BKE_view_layer_free_object_content(), BKE_view_layer_verify_aov(), BLI_args_destroy(), BLI_array_store_is_valid(), BLI_gset_free(), blo_cache_storage_end(), bm_edgering_pair_calc(), bm_edgering_pair_store_free(), bm_face_region_pivot_edge_find(), BM_mesh_bevel(), BM_mesh_edgesplit(), BM_mesh_intersect(), BM_mesh_remap(), bm_uidwalk_free(), bmo_extrude_discrete_faces_exec(), bmo_extrude_vert_indiv_exec(), bmo_inset_region_exec(), bmo_mesh_copy(), bmo_op_slots_free(), bmo_planar_faces_exec(), bmo_triangle_fill_exec(), bmo_weld_verts_exec(), BPY_rna_exit(), LibOverrideGroupTagData::clear(), collection_free_data(), blender::ed::transform::createTransObject(), blender::ed::object::data_xform_container_destroy(), discard_stabilization_working_context(), DNA_sdna_alias_data_ensure(), DNA_sdna_free(), ED_armature_join_objects_exec(), edbm_face_split_by_edges_exec(), filelist_free(), free_scratch(), fsmenu_xdg_user_dirs_free(), IMB_moviecache_free(), int4_ghash_tests(), int_ghash_tests(), knife_add_cut(), knifetool_exit_ex(), lib_override_library_main_resync_on_library_indirect_level(), lib_override_library_resync(), make_duplis_font(), blender::ed::object::make_object_duplilist_real(), make_structDNA(), mask_clipboard_free_ex(), blender::ed::transform::mesh_customdatacorrect_free(), mesh_get_x_mirror_faces(), mesh_undostep_reference_elems_from_objects(), modify_mesh(), multi_small_ghash_tests(), nlaeval_free(), palette_extract_img_exec(), randint_ghash_tests(), RNA_free(), scanfill_preprocess_self_isect(), state_delete(), stitch_init(), str_ghash_tests(), TEST(), TEST(), TEST(), TEST(), TEST(), text_autocomplete_free(), tracking_copy_context_delete(), tracks_map_free(), uv_sculpt_stroke_init(), wm_gizmomap_select_all_intern(), Freestyle::BlenderStrokeRenderer::~BlenderStrokeRenderer(), FileListEntryCache::~FileListEntryCache(), and blender::geometry::ParamHandle::~ParamHandle().

◆ BLI_ghash_haskey()

◆ BLI_ghash_insert()

void BLI_ghash_insert ( GHash * gh,
void * key,
void * val )

Insert a key/value pair into the gh.

Note
Duplicates are not checked, the caller is expected to ensure elements are unique unless GHASH_FLAG_ALLOW_DUPES flag is set.

Definition at line 707 of file BLI_ghash.cc.

References ghash_insert().

Referenced by _bmo_slot_copy(), add_hit_to_facehits(), armature_bone_from_name_insert_recursive(), armature_dissolve_selected_exec(), attach_stabilization_baseline_data(), bevel_vert_construct(), BKE_addon_pref_type_add(), BKE_collection_object_replace(), BKE_fcurve_pathcache_create(), BKE_icon_delete_unmanaged(), BKE_keyconfig_pref_type_add(), BKE_lib_override_library_property_get(), BKE_lib_override_library_property_rna_path_change(), BKE_library_make_local(), BKE_main_idmap_insert_id(), BKE_main_idmap_lookup_name(), BKE_mask_clipboard_copy_from_layer(), BKE_nlastrip_validate_name(), BKE_object_defgroup_validmap_get(), BKE_pose_channel_ensure(), BKE_pose_channels_hash_ensure(), BKE_previewimg_cached_thumbnail_read(), BKE_scene_undo_depsgraphs_extract(), BKE_vfontdata_char_from_freetypefont(), blo_cache_storage_entry_register(), bm_edgering_pair_calc(), bm_edgering_pair_store_create(), bm_isect_edge_tri(), BM_mesh_edgesplit(), BM_mesh_intersect_edges(), BM_mesh_remap(), BM_select_history_map_create(), bm_uidwalk_init_from_edge(), bm_uidwalk_pass_add(), bm_uidwalk_rehash_facelinks(), bmo_edge_copy(), BMO_slot_map_insert(), bmo_triangle_fill_exec(), bmo_vert_copy(), bmo_weld_verts_exec(), blender::ed::transform::createTransObject(), debug_data_insert(), DNA_sdna_alias_data_ensure_structs_map(), DNA_sdna_patch_struct(), ED_armature_bone_rename(), ED_armature_join_objects_exec(), ED_curve_keyindex_hash_duplicate(), filelist_entry_select_set(), filelist_file_cache_block_create(), filelist_file_ex(), find_family_object(), fsmenu_xdg_user_dirs_parse(), get_bm_knife_edge(), get_bm_knife_vert(), icon_create(), init_editNurb_keyIndex(), init_structDNA(), int4_ghash_tests(), int_ghash_tests(), internalAdd(), keyIndex_swap(), keyIndex_updateCV(), knife_get_face_kedges(), lib_override_library_resync(), blender::ed::transform::mesh_customdatacorrect_init_vert(), mesh_get_x_mirror_faces(), mesh_undostep_reference_elems_from_objects(), modify_mesh(), multi_small_ghash_tests_one(), override_library_rna_path_mapping_ensure(), palette_extract_img_exec(), randint_ghash_tests(), record_face_kind(), register_uv_face(), Freestyle::BlenderStrokeRenderer::RenderStrokeRepBasic(), rna_brna_structs_add(), RNA_def_struct_identifier(), RNA_init(), set_lowest_face_tri(), stitch_init(), str_ghash_tests(), TEST(), TEST(), TEST(), TEST(), TEST(), text_autocomplete_build(), tracking_plane_tracks_copy(), tracking_tracks_copy(), tracks_map_insert(), blender::geometry::uv_prepare_pin_index(), uv_sculpt_stroke_init(), and WM_gizmomap_gizmo_hash_new().

◆ BLI_ghash_int_new()

◆ BLI_ghash_int_new_ex()

GHash * BLI_ghash_int_new_ex ( const char * info,
unsigned int nentries_reserve )

◆ BLI_ghash_len()

◆ BLI_ghash_lookup()

void * BLI_ghash_lookup ( const GHash * gh,
const void * key )

Lookup the value of key in gh.

Parameters
keyThe key to lookup.
Returns
the value for key or NULL.
Note
When NULL is a valid value, use BLI_ghash_lookup_p to differentiate a missing key from a key with a NULL value. (Avoids calling BLI_ghash_haskey before BLI_ghash_lookup)

Definition at line 731 of file BLI_ghash.cc.

References BLI_assert, e, GHash::flag, and ghash_lookup_entry().

Referenced by access_stabilization_baseline_data(), add_hit_to_facehits(), BKE_addon_pref_type_find(), BKE_armature_find_bone_name(), BKE_collection_has_object(), BKE_fcurve_pathcache_find(), BKE_fcurve_pathcache_find_array(), BKE_keyconfig_pref_type_find(), BKE_lib_override_library_property_find(), BKE_library_main_rebuild_hierarchy(), BKE_main_idmap_lookup_name(), BKE_main_idmap_lookup_uid(), BKE_mask_clipboard_copy_from_layer(), BKE_mask_clipboard_paste_to_layer(), BKE_object_defgroup_validmap_get(), BKE_pose_channel_find_name(), BKE_pose_channels_is_valid(), BKE_previewimg_cached_get(), BKE_scene_get_depsgraph(), BKE_view_layer_base_find(), BKE_view_layer_verify_aov(), blo_cache_storage_entry_clear_in_old(), blo_cache_storage_entry_restore_in_new(), bm_edgering_pair_calc(), bm_edgering_pair_interpolate(), bm_face_region_pivot_edge_find(), bm_face_region_pivot_edge_use_best(), bm_face_region_vert_pass_id(), bm_isect_edge_tri(), BM_mesh_edgesplit(), BM_mesh_intersect_edges(), BM_mesh_remap(), BM_select_history_merge_from_targetmap(), bmo_edge_copy(), bmo_extrude_discrete_faces_exec(), bmo_extrude_vert_indiv_exec(), bmo_face_copy(), bmo_triangle_fill_exec(), calculate_struct_sizes(), ccd_update_deflector_hash_single(), collection_gobject_assert_internal_consistency(), blender::ed::transform::createTransObject(), debug_data_insert(), dna_sdna_alias_from_static_elem_full(), filelist_cache_file_lookup(), filelist_entry_is_selected(), filelist_entry_select_get(), find_bevvert(), find_uv_face(), blender::ed::outliner::foreach_natural_hierarchy_child(), fsmenu_xdg_insert_entry(), get_bm_knife_edge(), get_bm_knife_vert(), get_face_kind(), get_lowest_face_tri(), get_next_free_id(), getCVKeyIndex(), icon_ghash_lookup(), IMB_moviecache_get(), IMB_moviecache_has_frame(), int4_ghash_tests(), int_ghash_tests(), knife_get_face_kedges(), lib_override_hierarchy_dependencies_recursive_tag(), lib_override_hierarchy_dependencies_recursive_tag_from(), lib_override_library_main_resync_on_library_indirect_level(), lib_override_library_remap(), lib_override_library_resync(), lib_override_linked_group_tag(), lib_override_linked_group_tag_recursive(), lib_override_overrides_group_tag_recursive(), lib_override_resync_tagging_finalize(), lib_override_resync_tagging_finalize_recurse(), lib_override_resync_tagging_finalize_recursive_check_from(), lib_override_root_find(), lib_override_root_hierarchy_set(), lib_override_root_is_valid(), lib_query_unused_ids_has_exception_user(), lib_query_unused_ids_tag(), lib_query_unused_ids_tag_recurse(), library_foreach_ID_link(), library_make_local_copying_check(), lookUp(), blender::ed::object::make_object_duplilist_real(), blender::ed::transform::mesh_customdatacorrect_apply_vert(), mesh_get_x_mirror_faces(), blender::ed::transform::mesh_vert_orig_co_get(), modify_mesh(), multi_small_ghash_tests_one(), randint_ghash_tests(), rebuild_hierarchy_best_parent_find(), Freestyle::BlenderStrokeRenderer::RenderStrokeRepBasic(), RNA_def_struct(), RNA_def_struct_nested(), RNA_struct_find(), scanfill_preprocess_self_isect(), set_lowest_face_tri(), stitch_init(), stitch_uv_edge_generate_linked_edges(), str_ghash_tests(), TEST(), TEST(), text_autocomplete_build(), tracking_object_copy(), tracking_plane_tracks_copy(), tracks_map_merge(), uv_edge_get(), blender::geometry::uv_find_pin_index(), blender::geometry::uv_prepare_pin_index(), uv_sculpt_stroke_init(), version_member_static_from_alias(), version_struct_alias_from_static(), version_struct_static_from_alias(), and view_layer_objects_base_cache_validate().

◆ BLI_ghash_lookup_default()

void * BLI_ghash_lookup_default ( const GHash * gh,
const void * key,
void * val_default )

A version of BLI_ghash_lookup which accepts a fallback argument.

Definition at line 738 of file BLI_ghash.cc.

References BLI_assert, e, GHash::flag, and ghash_lookup_entry().

Referenced by DNA_sdna_alias_data_ensure(), and DNA_struct_find_index_wrapper().

◆ BLI_ghash_lookup_p()

void ** BLI_ghash_lookup_p ( GHash * gh,
const void * key )

Lookup a pointer to the value of key in gh.

Parameters
keyThe key to lookup.
Returns
the pointer to value for key or NULL.
Note
This has 2 main benefits over BLI_ghash_lookup.
  • A NULL return always means that key isn't in gh.
  • The value can be modified in-place without further function calls (faster).

Definition at line 745 of file BLI_ghash.cc.

References BLI_assert, e, GHash::flag, and ghash_lookup_entry().

Referenced by armature_dissolve_selected_exec(), BKE_object_defgroup_validmap_get(), BKE_object_material_remap_calc(), BKE_previewimg_cached_thumbnail_read(), BKE_scene_undo_depsgraphs_extract(), BKE_scene_undo_depsgraphs_restore(), bm_face_region_pivot_edge_find(), BM_mesh_intersect_edges(), bm_uidwalk_face_lookup(), bm_uidwalk_rehash_facelinks(), bm_uidwalk_vert_lookup(), dna_struct_find_index_ex_impl(), filelist_entry_select_set(), find_family_object(), lib_override_library_id_hierarchy_recursive_reset(), scene_get_depsgraph_p(), and vfont_char_find().

◆ BLI_ghash_new()

◆ BLI_ghash_new_ex()

GHash * BLI_ghash_new_ex ( GHashHashFP hashfp,
GHashCmpFP cmpfp,
const char * info,
unsigned int nentries_reserve )

Creates a new, empty GHash.

Parameters
hashfpHash callback.
cmpfpComparison callback.
infoIdentifier string for the GHash.
nentries_reserveOptionally reserve the number of members that the hash will hold. Use this to avoid resizing buckets if the size is known or can be closely approximated.
Returns
An empty GHash.

Definition at line 678 of file BLI_ghash.cc.

References ghash_new().

Referenced by BLI_ghash_int_new_ex(), BLI_ghash_new(), BLI_ghash_pair_new_ex(), BLI_ghash_ptr_new_ex(), BLI_ghash_str_new_ex(), FileListEntryCache::FileListEntryCache(), ghash_bmelem_new_ex(), and mesh_get_x_mirror_faces().

◆ BLI_ghash_pair_new()

GHash * BLI_ghash_pair_new ( const char * info)

Definition at line 220 of file BLI_ghash_utils.cc.

References BLI_ghash_pair_new_ex().

◆ BLI_ghash_pair_new_ex()

GHash * BLI_ghash_pair_new_ex ( const char * info,
unsigned int nentries_reserve )

◆ BLI_ghash_pop()

bool BLI_ghash_pop ( GHash * gh,
GHashIterState * state,
void ** r_key,
void ** r_val )

Remove a random entry from gh, returning true if a key/value pair could be removed, false otherwise.

Parameters
r_keyThe removed key.
r_valThe removed value.
stateUsed for efficient removal.
Returns
true if there was something to pop, false if ghash was already empty.

Definition at line 824 of file BLI_ghash.cc.

References BLI_assert, BLI_mempool_free(), e, GHash::entrypool, GHash::flag, ghash_pop(), and state.

Referenced by int_ghash_tests(), and TEST().

◆ BLI_ghash_popkey()

void * BLI_ghash_popkey ( GHash * gh,
const void * key,
GHashKeyFreeFP keyfreefp )

◆ BLI_ghash_ptr_new()

◆ BLI_ghash_ptr_new_ex()

◆ BLI_ghash_reinsert()

bool BLI_ghash_reinsert ( GHash * gh,
void * key,
void * val,
GHashKeyFreeFP keyfreefp,
GHashValFreeFP valfreefp )

Inserts a new value to a key that may already be in ghash.

Avoids BLI_ghash_remove, BLI_ghash_insert calls (double lookups)

Returns
true if a new key has been added.

Definition at line 712 of file BLI_ghash.cc.

References ghash_insert_safe().

Referenced by BKE_object_material_remap_calc(), do_moviecache_put(), and tracks_map_merge().

◆ BLI_ghash_remove()

◆ BLI_ghash_replace_key()

void * BLI_ghash_replace_key ( GHash * gh,
void * key )

Replaces the key of an item in the gh.

Use when a key is re-allocated or its memory location is changed.

Returns
The previous key or NULL if not found, the caller may free if it's needed.

Definition at line 718 of file BLI_ghash.cc.

References e, ghash_bucket_index(), ghash_keyhash(), ghash_lookup_entry_ex(), and hash.

Referenced by BLI_gset_replace_key().

◆ BLI_ghash_reserve()

void BLI_ghash_reserve ( GHash * gh,
unsigned int nentries_reserve )

Reserve given amount of entries (resize gh accordingly if needed).

Definition at line 696 of file BLI_ghash.cc.

References ghash_buckets_contract(), and ghash_buckets_expand().

Referenced by int4_ghash_tests(), int_ghash_tests(), multi_small_ghash_tests_one(), randint_ghash_tests(), and str_ghash_tests().

◆ BLI_ghash_str_new()

◆ BLI_ghash_str_new_ex()

◆ BLI_ghashIterator_done()

◆ BLI_ghashIterator_free()

◆ BLI_ghashIterator_getKey()

◆ BLI_ghashIterator_getValue()

◆ BLI_ghashIterator_getValue_p()

BLI_INLINE void ** BLI_ghashIterator_getValue_p ( GHashIterator * ghi)

◆ BLI_ghashIterator_init()

void BLI_ghashIterator_init ( GHashIterator * ghi,
GHash * gh )

Init an already allocated GHashIterator. The hash table must not be mutated while the iterator is in use, and the iterator will step exactly #BLI_ghash_len(gh) times before becoming done.

Parameters
ghiThe GHashIterator to initialize.
ghThe GHash to iterate over.

Definition at line 895 of file BLI_ghash.cc.

References GHash::buckets, GHashIterator::curBucket, GHashIterator::curEntry, GHashIterator::gh, GHash::nbuckets, GHash::nentries, UINT_MAX, and UNLIKELY.

Referenced by BKE_sim_debug_data_clear_category(), BLI_ghashIterator_new(), BLI_gsetIterator_init(), BMO_iter_new(), check_unused_keys(), and IMB_moviecache_cleanup().

◆ BLI_ghashIterator_new()

GHashIterator * BLI_ghashIterator_new ( GHash * gh)

Create a new GHashIterator. The hash table must not be mutated while the iterator is in use, and the iterator will step exactly #BLI_ghash_len(gh) times before becoming done.

Parameters
ghThe GHash to iterate over.
Returns
Pointer to a new iterator.

Definition at line 888 of file BLI_ghash.cc.

References BLI_ghashIterator_init(), and MEM_callocN().

Referenced by BKE_main_relations_tag_set(), BLI_gsetIterator_new(), IMB_moviecacheIter_new(), lib_override_library_main_resync_on_library_indirect_level(), sb_detect_aabb_collisionCached(), sb_detect_edge_collisionCached(), sb_detect_face_collisionCached(), sb_detect_face_pointCached(), and sb_detect_vertex_collisionCached().

◆ BLI_ghashIterator_step()

◆ BLI_ghashutil_combine_hash()

size_t BLI_ghashutil_combine_hash ( size_t hash_a,
size_t hash_b )

Definition at line 117 of file BLI_ghash_utils.cc.

Referenced by BKE_idtype_cache_key_hash().

◆ BLI_ghashutil_intcmp()

◆ BLI_ghashutil_inthash_p()

◆ BLI_ghashutil_inthash_p_murmur()

unsigned int BLI_ghashutil_inthash_p_murmur ( const void * ptr)

Definition at line 100 of file BLI_ghash_utils.cc.

References BLI_hash_mm2(), and ptr.

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ BLI_ghashutil_inthash_p_simple()

unsigned int BLI_ghashutil_inthash_p_simple ( const void * ptr)

Definition at line 107 of file BLI_ghash_utils.cc.

References POINTER_AS_UINT, and ptr.

◆ BLI_ghashutil_pairalloc()

GHashPair * BLI_ghashutil_pairalloc ( const void * first,
const void * second )

Definition at line 155 of file BLI_ghash_utils.cc.

References GHashPair::first, MEM_mallocN(), and GHashPair::second.

Referenced by bm_edgering_pair_calc().

◆ BLI_ghashutil_paircmp()

bool BLI_ghashutil_paircmp ( const void * a,
const void * b )

Definition at line 170 of file BLI_ghash_utils.cc.

References A, B, and b.

Referenced by BLI_ghash_pair_new_ex(), and BLI_gset_pair_new_ex().

◆ BLI_ghashutil_pairfree()

void BLI_ghashutil_pairfree ( void * ptr)

Definition at line 178 of file BLI_ghash_utils.cc.

References MEM_freeN(), and ptr.

◆ BLI_ghashutil_pairhash()

unsigned int BLI_ghashutil_pairhash ( const void * ptr)

◆ BLI_ghashutil_ptrcmp()

◆ BLI_ghashutil_ptrhash()

◆ BLI_ghashutil_strcmp()

bool BLI_ghashutil_strcmp ( const void * a,
const void * b )

◆ BLI_ghashutil_strhash_n()

unsigned int BLI_ghashutil_strhash_n ( const char * key,
size_t n )

This function implements the widely used djb hash apparently posted by Daniel Bernstein to comp.lang.c some time ago. The 32 bit unsigned hash value starts at 5381 and for each byte 'c' in the string, is updated: hash = hash * 33 + c. This function uses the signed value of each byte.

NOTE: this is the same hash method that glib 2.34.0 uses.

Definition at line 122 of file BLI_ghash_utils.cc.

◆ BLI_ghashutil_strhash_p()

◆ BLI_ghashutil_strhash_p_murmur()

unsigned int BLI_ghashutil_strhash_p_murmur ( const void * ptr)

◆ BLI_ghashutil_uinthash()

◆ BLI_ghashutil_uinthash_v4()

unsigned int BLI_ghashutil_uinthash_v4 ( const unsigned int key[4])

Definition at line 51 of file BLI_ghash_utils.cc.

References hash.

◆ BLI_ghashutil_uinthash_v4_cmp()

bool BLI_ghashutil_uinthash_v4_cmp ( const void * a,
const void * b )

Definition at line 69 of file BLI_ghash_utils.cc.

References b.

Referenced by TEST(), and TEST().

◆ BLI_ghashutil_uinthash_v4_murmur()

unsigned int BLI_ghashutil_uinthash_v4_murmur ( const unsigned int key[4])

Definition at line 64 of file BLI_ghash_utils.cc.

References BLI_hash_mm2().

◆ BLI_gset_add()

◆ BLI_gset_clear()

◆ BLI_gset_clear_ex()

void BLI_gset_clear_ex ( GSet * gs,
GSetKeyFreeFP keyfreefp,
unsigned int nentries_reserve )

Definition at line 1024 of file BLI_ghash.cc.

References BLI_ghash_clear_ex().

◆ BLI_gset_copy()

GSet * BLI_gset_copy ( const GSet * gs,
GSetKeyCopyFP keycopyfp )

Copy given GSet. Keys are also copied if callback is provided, else pointers remain the same.

Definition at line 949 of file BLI_ghash.cc.

References ghash_copy().

◆ BLI_gset_ensure_p_ex()

bool BLI_gset_ensure_p_ex ( GSet * gs,
const void * key,
void *** r_key )

Set counterpart to BLI_ghash_ensure_p_ex. similar to BLI_gset_add, except it returns the key pointer.

Warning
Caller must write to r_key when returning false.

Definition at line 971 of file BLI_ghash.cc.

References BLI_mempool_alloc(), e, ghash_bucket_index(), ghash_insert_ex_keyonly_entry(), ghash_keyhash(), ghash_lookup_entry_ex(), and hash.

Referenced by BKE_collection_validate(), bm_edgering_pair_calc(), object_base_unique(), wm_event_add_notifier_intern(), and WM_msg_subscribe_with_key().

◆ BLI_gset_flag_clear()

void BLI_gset_flag_clear ( GSet * gs,
unsigned int flag )

Definition at line 1044 of file BLI_ghash.cc.

References flag.

◆ BLI_gset_flag_set()

void BLI_gset_flag_set ( GSet * gs,
unsigned int flag )

Definition at line 1039 of file BLI_ghash.cc.

References flag.

◆ BLI_gset_free()

◆ BLI_gset_haskey()

◆ BLI_gset_insert()

◆ BLI_gset_int_new()

GSet * BLI_gset_int_new ( const char * info)

Definition at line 262 of file BLI_ghash_utils.cc.

References BLI_gset_int_new_ex().

Referenced by BKE_fcurves_calc_keyed_frames_ex().

◆ BLI_gset_int_new_ex()

GSet * BLI_gset_int_new_ex ( const char * info,
unsigned int nentries_reserve )

◆ BLI_gset_len()

◆ BLI_gset_lookup()

void * BLI_gset_lookup ( const GSet * gs,
const void * key )

◆ BLI_gset_new()

◆ BLI_gset_new_ex()

◆ BLI_gset_pair_new()

GSet * BLI_gset_pair_new ( const char * info)

Definition at line 253 of file BLI_ghash_utils.cc.

References BLI_gset_pair_new_ex().

Referenced by bm_edgering_pair_calc().

◆ BLI_gset_pair_new_ex()

GSet * BLI_gset_pair_new_ex ( const char * info,
unsigned int nentries_reserve )

◆ BLI_gset_pop()

bool BLI_gset_pop ( GSet * gs,
GSetIterState * state,
void ** r_key )

Remove a random entry from gs, returning true if a key could be removed, false otherwise.

Parameters
r_keyThe removed key.
stateUsed for efficient removal.
Returns
true if there was something to pop, false if gset was already empty.

Definition at line 1009 of file BLI_ghash.cc.

References BLI_mempool_free(), e, ghash_pop(), and state.

◆ BLI_gset_pop_key()

void * BLI_gset_pop_key ( GSet * gs,
const void * key )

Returns the pointer to the key if it's found, removing it from the GSet.

Note
Caller must handle freeing.

Definition at line 1064 of file BLI_ghash.cc.

References BLI_mempool_free(), e, ghash_bucket_index(), ghash_keyhash(), ghash_remove_ex(), and hash.

◆ BLI_gset_ptr_new()

◆ BLI_gset_ptr_new_ex()

GSet * BLI_gset_ptr_new_ex ( const char * info,
unsigned int nentries_reserve )

◆ BLI_gset_reinsert()

bool BLI_gset_reinsert ( GSet * gs,
void * key,
GSetKeyFreeFP keyfreefp )

Adds the key to the set (duplicates are managed). Matching BLI_ghash_reinsert

Returns
true if a new key has been added.

Definition at line 989 of file BLI_ghash.cc.

References ghash_insert_safe_keyonly().

Referenced by BKE_cachefile_reader_open().

◆ BLI_gset_remove()

◆ BLI_gset_replace_key()

void * BLI_gset_replace_key ( GSet * gs,
void * key )

Replaces the key to the set if it's found. Matching BLI_ghash_replace_key

Returns
The old key or NULL if not found.

Definition at line 994 of file BLI_ghash.cc.

References BLI_ghash_replace_key().

◆ BLI_gset_str_new()

GSet * BLI_gset_str_new ( const char * info)

Definition at line 244 of file BLI_ghash_utils.cc.

References BLI_gset_str_new_ex().

Referenced by IMB_thumb_locks_acquire().

◆ BLI_gset_str_new_ex()

GSet * BLI_gset_str_new_ex ( const char * info,
unsigned int nentries_reserve )

◆ BLI_gsetIterator_done()

BLI_INLINE bool BLI_gsetIterator_done ( const GSetIterator * gsi)

◆ BLI_gsetIterator_free()

BLI_INLINE void BLI_gsetIterator_free ( GSetIterator * gsi)

Definition at line 451 of file BLI_ghash.h.

References BLI_ghashIterator_free(), and BLI_INLINE.

◆ BLI_gsetIterator_getKey()

◆ BLI_gsetIterator_init()

BLI_INLINE void BLI_gsetIterator_init ( GSetIterator * gsi,
GSet * gs )

◆ BLI_gsetIterator_new()

BLI_INLINE GSetIterator * BLI_gsetIterator_new ( GSet * gs)

Definition at line 443 of file BLI_ghash.h.

References BLI_ghashIterator_new(), and BLI_INLINE.

◆ BLI_gsetIterator_step()

BLI_INLINE void BLI_gsetIterator_step ( GSetIterator * gsi)