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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-04-21 18:55:30 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-04-21 19:36:59 +0400
commit9bff19fbfd5292766671d2134a6442d5c3d7917a (patch)
treeef30d54615737d08f3a608f99500e12323b16f76 /source/blender/blenlib/intern/edgehash.c
parent64b6ea032d8f1f2df75b816a2cd270da48fe1e8e (diff)
GHash, Edgehash: add lookup_default() funcs.
Returns a fallback argument when the key isn't found.
Diffstat (limited to 'source/blender/blenlib/intern/edgehash.c')
-rw-r--r--source/blender/blenlib/intern/edgehash.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index 8558e5773c7..51a22cc46ab 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -356,6 +356,16 @@ void *BLI_edgehash_lookup(EdgeHash *eh, unsigned int v0, unsigned int v1)
}
/**
+ * A version of #BLI_edgehash_lookup which accepts a fallback argument.
+ */
+void *BLI_edgehash_lookup_default(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val_default)
+{
+ EdgeEntry *e = edgehash_lookup_entry(eh, v0, v1);
+ IS_EDGEHASH_ASSERT(eh);
+ return e ? e->val : val_default;
+}
+
+/**
* Return boolean true/false if edge (v0,v1) in hash.
*/
bool BLI_edgehash_haskey(EdgeHash *eh, unsigned int v0, unsigned int v1)