git » libfiu » commit daa8a5c

wtable: invalidate cache when adding an entry

author Tim Cuthbertson
2015-07-29 23:36:14 UTC
committer Alberto Bertogli
2015-08-02 13:35:53 UTC
parent f29b6bc48767020dc0a71c400ccb0b9be65c414f

wtable: invalidate cache when adding an entry

This fixes a bug where a cached negative result would
cause a failure to be skipped even after a matching failure
point is added.

libfiu/wtable.c +5 -0

diff --git a/libfiu/wtable.c b/libfiu/wtable.c
index bf77878..7e271fa 100644
--- a/libfiu/wtable.c
+++ b/libfiu/wtable.c
@@ -309,6 +309,11 @@ bool wtable_set(struct wtable *t, const char *key, void *value)
 				return false;
 		}
 
+		/* Invalidate the cache. We could be smart and walk it,
+		 * removing only the negative hits, but it's also more
+		 * expensive */
+		cache_invalidate(t->wcache);
+
 		return wildcards_set(t, strdup(key), value);
 	} else {
 		return hash_set(t->finals, key, value);