chiark / gitweb /
systemctl: fix enable/disable reply handling
[elogind.git] / src / journal / journald-rate-limit.c
index 8bd68476a39764e13eb1ff16afc218266af43cb8..4b7622152735b12bd513f3cb9a27150ca6f2801f 100644 (file)
@@ -96,8 +96,8 @@ static void journal_rate_limit_group_free(JournalRateLimitGroup *g) {
                 if (g->parent->lru_tail == g)
                         g->parent->lru_tail = g->lru_prev;
 
-                LIST_REMOVE(JournalRateLimitGroup, lru, g->parent->lru, g);
-                LIST_REMOVE(JournalRateLimitGroup, bucket, g->parent->buckets[g->hash % BUCKETS_MAX], g);
+                LIST_REMOVE(lru, g->parent->lru, g);
+                LIST_REMOVE(bucket, g->parent->buckets[g->hash % BUCKETS_MAX], g);
 
                 g->parent->n_groups --;
         }
@@ -115,7 +115,7 @@ void journal_rate_limit_free(JournalRateLimit *r) {
         free(r);
 }
 
-static bool journal_rate_limit_group_expired(JournalRateLimitGroup *g, usec_t ts) {
+_pure_ static bool journal_rate_limit_group_expired(JournalRateLimitGroup *g, usec_t ts) {
         unsigned i;
 
         assert(g);
@@ -156,8 +156,8 @@ static JournalRateLimitGroup* journal_rate_limit_group_new(JournalRateLimit *r,
 
         journal_rate_limit_vacuum(r, ts);
 
-        LIST_PREPEND(JournalRateLimitGroup, bucket, r->buckets[g->hash % BUCKETS_MAX], g);
-        LIST_PREPEND(JournalRateLimitGroup, lru, r->lru, g);
+        LIST_PREPEND(bucket, r->buckets[g->hash % BUCKETS_MAX], g);
+        LIST_PREPEND(lru, r->lru, g);
         if (!g->lru_next)
                 r->lru_tail = g;
         r->n_groups ++;
@@ -170,21 +170,6 @@ fail:
         return NULL;
 }
 
-static uint64_t u64log2(uint64_t n) {
-        unsigned r;
-
-        if (n <= 1)
-                return 0;
-
-        r = 0;
-        for (;;) {
-                n = n >> 1;
-                if (!n)
-                        return r;
-                r++;
-        }
-}
-
 static unsigned burst_modulate(unsigned burst, uint64_t available) {
         unsigned k;