summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-07-30 18:55:09 -0400
committerJune McEnroe <june@causal.agency>2022-07-30 18:55:09 -0400
commitb373a5c0919c972f69d44785ad74aa37afe113de (patch)
tree019e418d6c7cbe347db0b3aa522a5f0ac93a5145
parentSwitch to cache interfaces (diff)
downloadcatgirl-b373a5c0919c972f69d44785ad74aa37afe113de.tar.gz
catgirl-b373a5c0919c972f69d44785ad74aa37afe113de.zip
Rename cache{Prefix,Substr} to cache{Complete,Search}
-rw-r--r--cache.c4
-rw-r--r--chat.h4
-rw-r--r--command.c6
-rw-r--r--handle.c4
-rw-r--r--input.c4
5 files changed, 11 insertions, 11 deletions
diff --git a/cache.c b/cache.c
index a5348d2..fe2f2a4 100644
--- a/cache.c
+++ b/cache.c
@@ -130,7 +130,7 @@ enum Color cacheColor(uint id, const char *key) {
 	return (node ? node->color : Default);
 }
 
-const char *cachePrefix(struct Cursor *curs, uint id, const char *prefix) {
+const char *cacheComplete(struct Cursor *curs, uint id, const char *prefix) {
 	size_t len = strlen(prefix);
 	if (curs->gen != gen) curs->node = NULL;
 	for (
@@ -145,7 +145,7 @@ const char *cachePrefix(struct Cursor *curs, uint id, const char *prefix) {
 	return NULL;
 }
 
-const char *cacheSubstr(struct Cursor *curs, uint id, const char *substr) {
+const char *cacheSearch(struct Cursor *curs, uint id, const char *substr) {
 	if (curs->gen != gen) curs->node = NULL;
 	for (
 		curs->gen = gen, curs->node = (curs->node ? curs->node->next : head);
diff --git a/chat.h b/chat.h
index ea4ece3..1bc5f8f 100644
--- a/chat.h
+++ b/chat.h
@@ -404,8 +404,8 @@ void cacheInsert(bool touch, uint id, const char *key);
 void cacheInsertColor(bool touch, uint id, const char *key, enum Color color);
 void cacheReplace(bool touch, const char *old, const char *new);
 enum Color cacheColor(uint id, const char *key);
-const char *cachePrefix(struct Cursor *curs, uint id, const char *prefix);
-const char *cacheSubstr(struct Cursor *curs, uint id, const char *substr);
+const char *cacheComplete(struct Cursor *curs, uint id, const char *prefix);
+const char *cacheSearch(struct Cursor *curs, uint id, const char *substr);
 uint cacheID(struct Cursor *curs, const char *key);
 void cacheAccept(struct Cursor *curs);
 void cacheReject(struct Cursor *curs);
diff --git a/command.c b/command.c
index f5d9dbf..0926c33 100644
--- a/command.c
+++ b/command.c
@@ -397,7 +397,7 @@ static void commandWindow(uint id, char *params) {
 			return;
 		}
 		struct Cursor curs = {0};
-		for (const char *match; (match = cacheSubstr(&curs, None, params));) {
+		for (const char *match; (match = cacheSearch(&curs, None, params));) {
 			id = idFind(match);
 			if (!id) continue;
 			cacheAccept(&curs);
@@ -672,8 +672,8 @@ void command(uint id, char *input) {
 
 	struct Cursor curs = {0};
 	const char *cmd = strsep(&input, " ");
-	const char *unique = cachePrefix(&curs, None, cmd);
-	if (unique && !cachePrefix(&curs, None, cmd)) {
+	const char *unique = cacheComplete(&curs, None, cmd);
+	if (unique && !cacheComplete(&curs, None, cmd)) {
 		cmd = unique;
 	}
 
diff --git a/handle.c b/handle.c
index 8034957..2dfa3ae 100644
--- a/handle.c
+++ b/handle.c
@@ -641,7 +641,7 @@ static void handleReplyNoTopic(struct Message *msg) {
 static void topicCache(uint id, const char *topic) {
 	char buf[512];
 	struct Cursor curs = {0};
-	const char *prev = cachePrefix(&curs, id, "/topic ");
+	const char *prev = cacheComplete(&curs, id, "/topic ");
 	if (prev) {
 		snprintf(buf, sizeof(buf), "%s", prev);
 		cacheRemove(id, buf);
@@ -720,7 +720,7 @@ static void handleTopic(struct Message *msg) {
 	}
 
 	struct Cursor curs = {0};
-	const char *prev = cachePrefix(&curs, id, "/topic ");
+	const char *prev = cacheComplete(&curs, id, "/topic ");
 	if (prev) {
 		prev += 7;
 	} else {
diff --git a/input.c b/input.c
index 739d889..bcefee5 100644
--- a/input.c
+++ b/input.c
@@ -333,9 +333,9 @@ static int tabComplete(struct Edit *e, uint id) {
 		tab.suffix = true;
 	}
 
-	const char *comp = cachePrefix(&tab.curs, id, tab.pre);
+	const char *comp = cacheComplete(&tab.curs, id, tab.pre);
 	if (!comp) {
-		comp = cachePrefix(&tab.curs, id, tab.pre);
+		comp = cacheComplete(&tab.curs, id, tab.pre);
 		tab.suffix ^= true;
 	}
 	if (!comp) {