From 6f2f80887b10f6a704a7394f0580e6ee39ea611d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 25 Sep 2014 06:15:52 +1000 Subject: GHash: use bool for comparison (simplify compare) --- source/blender/blenkernel/intern/seqcache.c | 87 +++++------------------------ 1 file changed, 13 insertions(+), 74 deletions(-) (limited to 'source/blender/blenkernel/intern/seqcache.c') diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c index 97062f728c5..4268b33cb14 100644 --- a/source/blender/blenkernel/intern/seqcache.c +++ b/source/blender/blenkernel/intern/seqcache.c @@ -69,58 +69,15 @@ static struct SeqPreprocessCache *preprocess_cache = NULL; static void preprocessed_cache_destruct(void); -static int seq_cmp_render_data(const SeqRenderData *a, const SeqRenderData *b) +static bool seq_cmp_render_data(const SeqRenderData *a, const SeqRenderData *b) { - if (a->preview_render_size < b->preview_render_size) { - return -1; - } - if (a->preview_render_size > b->preview_render_size) { - return 1; - } - - if (a->rectx < b->rectx) { - return -1; - } - if (a->rectx > b->rectx) { - return 1; - } - - if (a->recty < b->recty) { - return -1; - } - if (a->recty > b->recty) { - return 1; - } - - if (a->bmain < b->bmain) { - return -1; - } - if (a->bmain > b->bmain) { - return 1; - } - - if (a->scene < b->scene) { - return -1; - } - if (a->scene > b->scene) { - return 1; - } - - if (a->motion_blur_shutter < b->motion_blur_shutter) { - return -1; - } - if (a->motion_blur_shutter > b->motion_blur_shutter) { - return 1; - } - - if (a->motion_blur_samples < b->motion_blur_samples) { - return -1; - } - if (a->motion_blur_samples > b->motion_blur_samples) { - return 1; - } - - return 0; + return ((a->preview_render_size != b->preview_render_size) || + (a->rectx != b->rectx) || + (a->recty != b->recty) || + (a->bmain != b->bmain) || + (a->scene != b->scene) || + (a->motion_blur_shutter != b->motion_blur_shutter) || + (a->motion_blur_samples != b->motion_blur_samples)); } static unsigned int seq_hash_render_data(const SeqRenderData *a) @@ -148,33 +105,15 @@ static unsigned int seqcache_hashhash(const void *key_) return rval; } -static int seqcache_hashcmp(const void *a_, const void *b_) +static bool seqcache_hashcmp(const void *a_, const void *b_) { const SeqCacheKey *a = (SeqCacheKey *) a_; const SeqCacheKey *b = (SeqCacheKey *) b_; - if (a->seq < b->seq) { - return -1; - } - if (a->seq > b->seq) { - return 1; - } - - if (a->cfra < b->cfra) { - return -1; - } - if (a->cfra > b->cfra) { - return 1; - } - - if (a->type < b->type) { - return -1; - } - if (a->type > b->type) { - return 1; - } - - return seq_cmp_render_data(&a->context, &b->context); + return ((a->seq != b->seq) || + (a->cfra != b->cfra) || + (a->type != b->type) || + seq_cmp_render_data(&a->context, &b->context)); } void BKE_sequencer_cache_destruct(void) -- cgit v1.2.3