diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-10-14 06:10:14 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-10-14 06:11:19 +0200 |
commit | 71fda00f320379f5cbee8e118848de98caaa229d (patch) | |
tree | 00a913086d70abadb1185e1343d97df860b0d612 /src/journal | |
parent | 14bf2c9d375db6a4670bc0ef0e521e35a939a498 (diff) |
list: make our list macros a bit easier to use by not requring type spec on each invocation
We can determine the list entry type via the typeof() gcc construct, and
so we should to make the macros much shorter to use.
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journald-rate-limit.c | 8 | ||||
-rw-r--r-- | src/journal/journald-stream.c | 4 | ||||
-rw-r--r-- | src/journal/mmap-cache.c | 16 | ||||
-rw-r--r-- | src/journal/sd-journal.c | 4 |
4 files changed, 16 insertions, 16 deletions
diff --git a/src/journal/journald-rate-limit.c b/src/journal/journald-rate-limit.c index 32e35a926d..4b76221527 100644 --- a/src/journal/journald-rate-limit.c +++ b/src/journal/journald-rate-limit.c @@ -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 --; } @@ -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 ++; diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index 543614aead..9ca26e26d6 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -324,7 +324,7 @@ void stdout_stream_free(StdoutStream *s) { if (s->server) { assert(s->server->n_stdout_streams > 0); s->server->n_stdout_streams --; - LIST_REMOVE(StdoutStream, stdout_stream, s->server->stdout_streams, s); + LIST_REMOVE(stdout_stream, s->server->stdout_streams, s); } if (s->fd >= 0) { @@ -404,7 +404,7 @@ int stdout_stream_new(Server *s) { } stream->server = s; - LIST_PREPEND(StdoutStream, stdout_stream, s->stdout_streams, stream); + LIST_PREPEND(stdout_stream, s->stdout_streams, stream); s->n_stdout_streams ++; return 0; diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c index 03b57beb04..6c9194a1a5 100644 --- a/src/journal/mmap-cache.c +++ b/src/journal/mmap-cache.c @@ -110,13 +110,13 @@ static void window_unlink(Window *w) { munmap(w->ptr, w->size); if (w->fd) - LIST_REMOVE(Window, by_fd, w->fd->windows, w); + LIST_REMOVE(by_fd, w->fd->windows, w); if (w->in_unused) { if (w->cache->last_unused == w) w->cache->last_unused = w->unused_prev; - LIST_REMOVE(Window, unused, w->cache->unused, w); + LIST_REMOVE(unused, w->cache->unused, w); } LIST_FOREACH(by_window, c, w->contexts) { @@ -180,11 +180,11 @@ static void context_detach_window(Context *c) { w = c->window; c->window = NULL; - LIST_REMOVE(Context, by_window, w->contexts, c); + LIST_REMOVE(by_window, w->contexts, c); if (!w->contexts && !w->keep_always) { /* Not used anymore? */ - LIST_PREPEND(Window, unused, c->cache->unused, w); + LIST_PREPEND(unused, c->cache->unused, w); if (!c->cache->last_unused) c->cache->last_unused = w; @@ -203,7 +203,7 @@ static void context_attach_window(Context *c, Window *w) { if (w->in_unused) { /* Used again? */ - LIST_REMOVE(Window, unused, c->cache->unused, w); + LIST_REMOVE(unused, c->cache->unused, w); if (c->cache->last_unused == w) c->cache->last_unused = w->unused_prev; @@ -211,7 +211,7 @@ static void context_attach_window(Context *c, Window *w) { } c->window = w; - LIST_PREPEND(Context, by_window, w->contexts, c); + LIST_PREPEND(by_window, w->contexts, c); } static Context *context_add(MMapCache *m, unsigned id) { @@ -511,11 +511,11 @@ static int add_mmap( w->size = wsize; w->fd = f; - LIST_PREPEND(Window, by_fd, f->windows, w); + LIST_PREPEND(by_fd, f->windows, w); context_detach_window(c); c->window = w; - LIST_PREPEND(Context, by_window, w->contexts, c); + LIST_PREPEND(by_window, w->contexts, c); *ret = (uint8_t*) w->ptr + (offset - w->offset); return 1; diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 7700d6cb12..3ccb14a242 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -186,7 +186,7 @@ static Match *match_new(Match *p, MatchType t) { if (p) { m->parent = p; - LIST_PREPEND(Match, matches, p->matches, m); + LIST_PREPEND(matches, p->matches, m); } return m; @@ -199,7 +199,7 @@ static void match_free(Match *m) { match_free(m->matches); if (m->parent) - LIST_REMOVE(Match, matches, m->parent->matches, m); + LIST_REMOVE(matches, m->parent->matches, m); free(m->data); free(m); |