Fix ordering in perl subscription_list
[blerg.git] / common / stringring.c
index 5f7101a..7784e1b 100644 (file)
@@ -152,6 +152,21 @@ int stringring_remove_index(struct stringring *sr, int idx) {
        return ret;
 }
 
+int stringring_touch(struct stringring *sr, const char *data) {
+       STRINGRING_DATA_CHECK();
+       int ret, idx;
+
+       flock(sr->fd, LOCK_EX);
+       idx = stringring_find_unlocked(sr, data, 0);
+       ret = idx >= 0;
+       if (ret) {
+               sr->sb->entries[idx].timestamp = time(NULL);
+       }
+       flock(sr->fd, LOCK_UN);
+
+       return ret;
+}
+
 int stringring_remove(struct stringring *sr, const char *data) {
        STRINGRING_DATA_CHECK();
        int ret;