[Bf-blender-cvs] [a2386b3] master: Fix previous commit rB34abb614f1344a6, which broke addons translations.
Bastien Montagne
noreply at git.blender.org
Thu Sep 25 14:34:24 CEST 2014
Commit: a2386b3e20ea4ddf56525221216aa06900050d5a
Author: Bastien Montagne
Date: Thu Sep 25 14:29:23 2014 +0200
Branches: master
https://developer.blender.org/rBa2386b3e20ea4ddf56525221216aa06900050d5a
Fix previous commit rB34abb614f1344a6, which broke addons translations.
Ghash comp callbacks must return false in case a & b are equal!
Also slightly cleaned up gash code using those comp func,
since those return booleans now, let's compare tham against booleans!
===================================================================
M source/blender/blenlib/intern/BLI_ghash.c
M source/blender/python/intern/bpy_app_translations.c
===================================================================
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index aa17ef3..6747e5c 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -155,7 +155,7 @@ BLI_INLINE Entry *ghash_lookup_entry_ex(GHash *gh, const void *key,
Entry *e;
for (e = gh->buckets[hash]; e; e = e->next) {
- if (UNLIKELY(gh->cmpfp(key, e->key) == 0)) {
+ if (UNLIKELY(gh->cmpfp(key, e->key) == false)) {
return e;
}
}
@@ -251,7 +251,7 @@ static Entry *ghash_remove_ex(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GH
Entry *e_prev = NULL;
for (e = gh->buckets[hash]; e; e = e->next) {
- if (UNLIKELY(gh->cmpfp(key, e->key) == 0)) {
+ if (UNLIKELY(gh->cmpfp(key, e->key) == false)) {
Entry *e_next = e->next;
if (keyfreefp) keyfreefp(e->key);
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c
index 72ae7bb..0114e8e 100644
--- a/source/blender/python/intern/bpy_app_translations.c
+++ b/source/blender/python/intern/bpy_app_translations.c
@@ -92,10 +92,9 @@ static bool _ghashutil_keycmp(const void *a, const void *b)
const GHashKey *B = b;
/* Note: comparing msgid first, most of the time it will be enough! */
- int cmp = BLI_ghashutil_strcmp(A->msgid, B->msgid);
- if (cmp == 0)
- return BLI_ghashutil_strcmp(A->msgctxt, B->msgctxt) == 0;
- return false;
+ if (BLI_ghashutil_strcmp(A->msgid, B->msgid) == false)
+ return BLI_ghashutil_strcmp(A->msgctxt, B->msgctxt);
+ return true; /* true means they are not equal! */
}
static void _ghashutil_keyfree(void *ptr)
More information about the Bf-blender-cvs
mailing list