piece-chain

Research & implementation of a Piece Chain
git clone git://src.gearsix.net/piece-chain.git
Log | Files | Refs | Atom | README

commit 7cc429d267d5ed23fd26750965873449f07185cb
parent 936af64091d463485cd5df7a4a60886de31e8f6f
Author: gearsix <gearsix@tuta.io>
Date:   Mon,  4 Jul 2022 16:19:29 +0100

prettied print() in test.c; make test produces 'ec-test'

Diffstat:
MMakefile | 2+-
Mtest.c | 19++++++++++++-------
2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile @@ -5,4 +5,4 @@ OPTS := -g -Wall -Wpedantic -std=c89 all: ${CC} $(OPTS) $(SRC) main.c -o $(OUT) test: - ${CC} $(OPTS) $(SRC) test.c -o $(OUT) + ${CC} $(OPTS) $(SRC) test.c -o $(OUT)-test diff --git a/test.c b/test.c @@ -22,13 +22,18 @@ void setup() void print(Buf *b) { - Piece *p; - - printf("b->tail: %p\tb->pos: %p\tb->head: %p\n\n", - (void *)b->tail, (void *)b->pos, (void *)b->head); - - for (p = b->tail; p != NULL; p = p->next) - printf("%p\n", (void *)p); + Piece *p = b->tail; + + printf("Buf: %p\n", (void *)b); + printf("size: %lu, index: %lu\n", b->size, b->idx); + do { + printf("%p", (void *)p); + if (p == b->tail) printf("<-tail"); + if (p == b->pos) printf("<-pos"); + if (p == b->head) printf("<-head"); + puts(""); + } while ((p = p->next)); + printf("\n"); } void test_bufinit()