diff options
Diffstat (limited to 'src/pulsecore/idxset.c')
-rw-r--r-- | src/pulsecore/idxset.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/pulsecore/idxset.c b/src/pulsecore/idxset.c index fb4497b8..24a28db7 100644 --- a/src/pulsecore/idxset.c +++ b/src/pulsecore/idxset.c @@ -66,7 +66,7 @@ unsigned pa_idxset_string_hash_func(const void *p) { const char *c; for (c = p; *c; c++) - hash = 31 * hash + *c; + hash = 31 * hash + (unsigned) *c; return hash; } @@ -80,7 +80,7 @@ unsigned pa_idxset_trivial_hash_func(const void *p) { } int pa_idxset_trivial_compare_func(const void *a, const void *b) { - return a != b; + return a < b ? -1 : (a > b ? 1 : 0); } pa_idxset* pa_idxset_new(pa_hash_func_t hash_func, pa_compare_func_t compare_func) { @@ -318,8 +318,7 @@ void* pa_idxset_rrobin(pa_idxset *s, uint32_t *idx) { hash = *idx % NBUCKETS; - if (!(e = index_scan(s, hash, *idx))) - return NULL; + e = index_scan(s, hash, *idx); if (e && e->iterate_next) e = e->iterate_next; |