summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cache.c9
-rw-r--r--src/defs.h3
-rw-r--r--src/main.c2
3 files changed, 5 insertions, 9 deletions
diff --git a/src/cache.c b/src/cache.c
index 19c5a92..5443e28 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
-/* Copyright (C) 2020 Gediminas Jakutis */
+/* Copyright (C) 2020-2021 Gediminas Jakutis */
#include <errno.h>
#include <stdlib.h>
@@ -230,15 +230,13 @@ int cached_put_list(struct stream * const restrict in, const struct entry_l * co
int ret = 0;
if (!in->cnode) { /* if this is the very first one */
- in->pnode = NULL;
in->cnode = in->cache_l;
in->cnode->val = node->val;
in->cnode->next = NULL;
in->index = 0;
} else {
- in->pnode = in->cnode;
- in->cnode = in->cnode + 1; /* lol says librin, lmao */
- in->pnode->next = in->cnode;
+ in->cnode->next = in->cnode + 1; /* lol says librin, lmao */
+ in->cnode = in->cnode->next;
in->cnode->val = node->val;
in->cnode->next = NULL;
++in->index;
@@ -251,7 +249,6 @@ int cache_rewind(struct stream * const in)
{
int ret = 0;
- in->pnode = NULL;
in->cnode = in->cnode ? in->cache_l : NULL;
in->index = 0;
diff --git a/src/defs.h b/src/defs.h
index e90f0e5..a0d61cd 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-only */
-/* Copyright (C) 2020 Gediminas Jakutis */
+/* Copyright (C) 2020-2021 Gediminas Jakutis */
#ifndef ALGOS_DEFS_H_INCLUDED
#define ALGOS_DEFS_H_INCLUDED
@@ -100,7 +100,6 @@ struct stream {
enum streamtype type;
char *name;
size_t index;
- struct entry_l *pnode; /* "previous" node */
struct entry_l *cnode; /* "current" node */
union cachewrap;
struct settings *settings;
diff --git a/src/main.c b/src/main.c
index ccdbfc2..9d66594 100644
--- a/src/main.c
+++ b/src/main.c
@@ -26,7 +26,7 @@ static int stub_split(struct stream * const in, struct stream * const a, struct
static const struct stream stream_blank = {
.n = 0, .type = stream_invalid, .fd = -1, .settings = &settings,
- .name = NULL, .index = 0, .pnode = NULL, .cnode = NULL, .cache = NULL,
+ .name = NULL, .index = 0, .cnode = NULL, .cache = NULL,
.get_next_element_direct = stub_getnext,
.get_next_element_cache = stub_getnext,
.place_next_element_direct = stub_put,