summary refs log tree commit diff
path: root/scoop.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-01-01 16:53:39 -0500
committerJune McEnroe <june@causal.agency>2020-01-01 16:54:04 -0500
commit0b0393afc109ec5fbc2d2ce5bcd4b2ebc9e2e9eb (patch)
tree7750cc80d1fd6d8f81c651ea4baefbbfe280c3d4 /scoop.c
parentAdd option for custom where expression to scoop (diff)
downloadlitterbox-0b0393afc109ec5fbc2d2ce5bcd4b2ebc9e2e9eb.tar.gz
litterbox-0b0393afc109ec5fbc2d2ce5bcd4b2ebc9e2e9eb.zip
Factor out hashing function
Diffstat (limited to '')
-rw-r--r--scoop.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/scoop.c b/scoop.c
index d21d77e..6caafe9 100644
--- a/scoop.c
+++ b/scoop.c
@@ -79,14 +79,7 @@ static const int Colors[] = {
 };
 
 static int color(const char *user) {
-	if (*user == '~') user++;
-	uint32_t hash = 0;
-	for (; *user; ++user) {
-		hash = (hash << 5) | (hash >> 27);
-		hash ^= *user;
-		hash *= 0x27220A95;
-	}
-	return Colors[hash % ARRAY_LEN(Colors)];
+	return Colors[hash(user) % ARRAY_LEN(Colors)];
 }
 
 static void formatColor(bool group, struct Event e) {
0'>2019-12-22Add The Book of EttaJune McEnroe 2019-12-21Revert "Add first working version of imbox"June McEnroe 2019-12-21Add first working version of imboxJune McEnroe 2019-12-20Respect mailmap in gl pretty formatJune McEnroe 2019-12-20Set LANG in cgit filtersJune McEnroe 2019-12-20Source .editrc before applying -v or -eJune McEnroe 2019-12-20Disable signing commitsJune McEnroe 2019-12-19Ignore about-filterJune McEnroe 2019-12-19Fix matching make tags with no sourcesJune McEnroe 2019-12-19Avoid matching := assignments as tagsJune McEnroe 2019-12-18Hide line numbers when rendering mdocJune McEnroe 2019-12-18Customize cgit CSSJune McEnroe 2019-12-18Use :target rather than :focus pseudo-classJune McEnroe 2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe 2019-12-18Add git.causal.agency cgit configJune McEnroe 2019-12-18Bail from hi if input is binaryJune McEnroe 2019-12-16Post "cgit setup"June McEnroe