diff options
author | emersion <contact@emersion.fr> | 2018-09-04 23:08:45 +0200 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-09-04 23:08:45 +0200 |
commit | 1342393632ca93c340fb4bc1dcb2824424bee939 (patch) | |
tree | 09a8fd8a8bde6ae1f057351a0ed43edd24c512c8 | |
parent | 5b13b8a12c55b3216b1b92a20474efc856be5d7b (diff) |
backend/drm: cosmetic enhancements
-rw-r--r-- | backend/drm/util.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/backend/drm/util.c b/backend/drm/util.c index c97afac6..050da2a6 100644 --- a/backend/drm/util.c +++ b/backend/drm/util.c @@ -265,25 +265,26 @@ static bool match_obj_(struct match_state *st, size_t skips, size_t score, size_ ++replaced; } - bool is_best = false; - for (st->res[i] = 0; st->res[i] < st->num_objs; ++st->res[i]) { + bool has_best = false; + for (size_t candidate = 0; candidate < st->num_objs; ++candidate) { // We tried this earlier - if (st->res[i] == st->orig[i]) { + if (candidate == st->orig[i]) { continue; } // Not compatible - if (!(st->objs[st->res[i]] & (1 << i))) { + if (!(st->objs[candidate] & (1 << i))) { continue; } // Already taken - if (is_taken(i, st->res, st->res[i])) { + if (is_taken(i, st->res, candidate)) { continue; } + st->res[i] = candidate; if (match_obj_(st, skips, score + 1, replaced, i + 1)) { - is_best = true; + has_best = true; } if (st->exit_early) { @@ -291,7 +292,7 @@ static bool match_obj_(struct match_state *st, size_t skips, size_t score, size_ } } - if (is_best) { + if (has_best) { return true; } |