summary refs log tree commit diff
path: root/bin/edi/log.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-11-18 15:54:38 -0500
committerJune McEnroe <june@causal.agency>2018-11-18 15:54:38 -0500
commitcedaa478cf090751e155711f1a0d0a2a459b4fdd (patch)
treeaaa16afb750d0ee5329fc252821782ed00e3d60f /bin/edi/log.c
parentAdd Go Mono variants (diff)
downloadsrc-cedaa478cf090751e155711f1a0d0a2a459b4fdd.tar.gz
src-cedaa478cf090751e155711f1a0d0a2a459b4fdd.zip
Avoid DST struct Table
Diffstat (limited to '')
-rw-r--r--bin/edi/log.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/bin/edi/log.c b/bin/edi/log.c
index b0bd117e..c91f5fd9 100644
--- a/bin/edi/log.c
+++ b/bin/edi/log.c
@@ -27,26 +27,26 @@ struct Log logAlloc(size_t cap) {
 	struct State *states = malloc(sizeof(*states) * cap);
 	if (!states) err(EX_OSERR, "malloc");
 	states[0] = (struct State) {
-		.table = NULL,
+		.table = TableEmpty,
 		.prev = 0,
 		.next = 0,
 	};
 	return (struct Log) {
 		.cap = cap,
 		.len = 1,
-		.index = 0,
+		.idx = 0,
 		.states = states,
 	};
 }
 
 void logFree(struct Log *log) {
 	for (size_t i = 0; i < log->len; ++i) {
-		free(log->states[i].table);
+		free(log->states[i].table.slices);
 	}
 	free(log->states);
 }
 
-void logPush(struct Log *log, struct Table *table) {
+void logPush(struct Log *log, struct Table table) {
 	if (log->len == log->cap) {
 		log->cap *= 2;
 		log->states = realloc(log->states, sizeof(*log->states) * log->cap);
@@ -55,9 +55,9 @@ void logPush(struct Log *log, struct Table *table) {
 	size_t next = log->len++;
 	log->states[next] = (struct State) {
 		.table = table,
-		.prev = log->index,
+		.prev = log->idx,
 		.next = next,
 	};
-	log->states[log->index].next = next;
-	log->index = next;
+	log->states[log->idx].next = next;
+	log->idx = next;
 }