crypto/shachain/tools: update to new rbuf API.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 21 Sep 2018 07:31:09 +0000 (17:01 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 12 Oct 2018 00:02:17 +0000 (10:32 +1030)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/crypto/shachain/tools/Makefile
ccan/crypto/shachain/tools/shachain48.c

index a1b0177c7935314b871647734846b306b674930f..f14646ff0126a4c4a94073e4ddf3805a1d10af8c 100644 (file)
@@ -5,7 +5,7 @@ CFLAGS=-Wall -Werror -O3 -I$(CCANDIR) -DSHACHAIN_BITS=48
 #CFLAGS=-Wall -Werror -g3 -I$(CCANDIR) -DSHACHAIN_BITS=48
 
 # 48 bit index for shachain.  This is what lightning uses.
-CCAN_OBJS:=ccan-str.o ccan-err.o ccan-hex.o ccan-shachain.o ccan-sha256.o ccan-rbuf.o
+CCAN_OBJS:=ccan-str.o ccan-err.o ccan-hex.o ccan-shachain.o ccan-sha256.o ccan-rbuf.o ccan-membuf.o
 
 all: shachain48
 
@@ -15,6 +15,7 @@ shachain48.o: $(CCANDIR)/ccan/crypto/shachain/shachain.h      \
        $(CCANDIR)/ccan/str/hex/hex.h                   \
        $(CCANDIR)/ccan/str/str.h                               \
        $(CCANDIR)/ccan/err/err.h                               \
+       $(CCANDIR)/ccan/membuf/membuf.h                         \
        $(CCANDIR)/ccan/rbuf/rbuf.h
 
 shachain48.o $(CCAN_OBJS): $(CCANDIR)/config.h
@@ -37,3 +38,5 @@ ccan-sha256.o: $(CCANDIR)/ccan/crypto/sha256/sha256.c
        $(CC) $(CFLAGS) -c -o $@ $<
 ccan-rbuf.o: $(CCANDIR)/ccan/rbuf/rbuf.c
        $(CC) $(CFLAGS) -c -o $@ $<
+ccan-membuf.o: $(CCANDIR)/ccan/membuf/membuf.c
+       $(CC) $(CFLAGS) -c -o $@ $<
index 5cc910909ba1d33a9f151701a76134d9d328a0a2..85dbf062d91ae918946628b3c1e9e7891e0acc61 100644 (file)
@@ -16,9 +16,9 @@ int main(int argc, char *argv[])
                char *p;
 
                shachain_init(&s);
-               rbuf_init(&rbuf, STDIN_FILENO, malloc(size), size);
+               rbuf_init(&rbuf, STDIN_FILENO, malloc(size), size, membuf_realloc);
 
-               while ((p = rbuf_read_str(&rbuf, '\n', realloc)) != NULL) {
+               while ((p = rbuf_read_str(&rbuf, '\n')) != NULL) {
                        struct sha256 hash;
                        unsigned long long idx;