nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit a937eb3f12f80497a90a1f6f1c6dbc11a07b3c00
parent 8ec69f4a3c4adfd3f9f51f4eb64242cdc7f65eae
Author: Rusty Russell <rusty@rustcorp.com.au>
Date:   Sat, 17 Aug 2024 14:57:12 +0930

Makefile: build using ccan/ versions of files.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


Diffstat:
MMakefile | 11+++++++----
Mccan/ccan/array_size/array_size.h | 2+-
Mccan/ccan/container_of/container_of.h | 2+-
Mccan/ccan/crypto/sha256/sha256.c | 4++--
Mccan/ccan/list/list.h | 4++--
Mccan/ccan/mem/mem.h | 2+-
Mccan/ccan/structeq/structeq.h | 4++--
Mccan/ccan/take/take.c | 2+-
Mccan/ccan/tal/str/str.c | 1-
Mccan/ccan/tal/str/str.h | 2+-
Mccan/ccan/tal/tal.c | 6+++---
Mccan/ccan/tal/tal.h | 10+++++-----
Msrc/bolt11/amount.c | 6+++---
Msrc/bolt11/amount.h | 4++--
Msrc/bolt11/bech32_util.h | 2+-
Msrc/bolt11/bolt11.c | 16++++++++--------
Msrc/bolt11/bolt11.h | 4++--
Msrc/bolt11/hash_u5.c | 3++-
Msrc/bolt11/hash_u5.h | 4++--
Msrc/bolt11/node_id.h | 4++--
Msrc/bolt11/overflows.h | 2+-
Msrc/nostrdb.c | 2+-
22 files changed, 50 insertions(+), 47 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,8 +1,11 @@ -CFLAGS = -Wall -Wno-misleading-indentation -Wno-unused-function -Werror -O2 -g -Isrc -Ideps/secp256k1/include -Ideps/lmdb -Ideps/flatcc/include -HEADERS = deps/lmdb/lmdb.h deps/secp256k1/include/secp256k1.h src/sha256.h src/nostrdb.h src/cursor.h src/hex.h src/jsmn.h src/config.h src/sha256.h src/random.h src/memchr.h src/cpu.h src/nostr_bech32.h src/block.h src/str_block.h $(C_BINDINGS) +# ccan/ expects config.h in "../config.h": -I src/bolt11 makes this "work". +CFLAGS = -Wall -Wno-misleading-indentation -Wno-unused-function -Werror -O2 -g -Isrc -Ideps/secp256k1/include -Ideps/lmdb -Ideps/flatcc/include -Isrc/bolt11/ -Iccan/ +CCAN_SRCS := ccan/ccan/utf8/utf8.c ccan/ccan/tal/tal.c ccan/ccan/tal/str/str.c ccan/ccan/list/list.c ccan/ccan/mem/mem.c ccan/ccan/crypto/sha256/sha256.c ccan/ccan/take/take.c +CCAN_HDRS := ccan/ccan/utf8/utf8.h ccan/ccan/container_of/container_of.h ccan/ccan/check_type/check_type.h ccan/ccan/str/str.h ccan/ccan/tal/str/str.h ccan/ccan/tal/tal.h ccan/ccan/list/list.h ccan/ccan/structeq/structeq.h ccan/ccan/typesafe_cb/typesafe_cb.h ccan/ccan/short_types/short_types.h ccan/ccan/mem/mem.h ccan/ccan/likely/likely.h ccan/ccan/alignof/alignof.h ccan/ccan/crypto/sha256/sha256.h ccan/ccan/array_size/array_size.h ccan/ccan/endian/endian.h ccan/ccan/take/take.h ccan/ccan/build_assert/build_assert.h ccan/ccan/cppmagic/cppmagic.h +HEADERS = deps/lmdb/lmdb.h deps/secp256k1/include/secp256k1.h src/nostrdb.h src/cursor.h src/hex.h src/jsmn.h src/config.h src/random.h src/memchr.h src/cpu.h src/nostr_bech32.h src/block.h src/str_block.h $(C_BINDINGS) $(CCAN_HDRS) FLATCC_SRCS=deps/flatcc/src/runtime/json_parser.c deps/flatcc/src/runtime/verifier.c deps/flatcc/src/runtime/builder.c deps/flatcc/src/runtime/emitter.c deps/flatcc/src/runtime/refmap.c -BOLT11_SRCS = src/bolt11/bolt11.c src/bolt11/bech32.c src/bolt11/tal.c src/bolt11/talstr.c src/bolt11/take.c src/bolt11/list.c src/bolt11/utf8.c src/bolt11/amount.c src/bolt11/hash_u5.c -SRCS = src/nostrdb.c src/sha256.c src/invoice.c src/nostr_bech32.c src/content_parser.c src/block.c $(BOLT11_SRCS) $(FLATCC_SRCS) +BOLT11_SRCS = src/bolt11/bolt11.c src/bolt11/bech32.c src/bolt11/amount.c src/bolt11/hash_u5.c +SRCS = src/nostrdb.c src/invoice.c src/nostr_bech32.c src/content_parser.c src/block.c $(BOLT11_SRCS) $(FLATCC_SRCS) $(CCAN_SRCS) LDS = $(OBJS) $(ARS) OBJS = $(SRCS:.c=.o) DEPS = $(OBJS) $(HEADERS) $(ARS) diff --git a/ccan/ccan/array_size/array_size.h b/ccan/ccan/array_size/array_size.h @@ -2,7 +2,7 @@ #ifndef CCAN_ARRAY_SIZE_H #define CCAN_ARRAY_SIZE_H #include "../config.h" -#include "build_assert.h" +#include "ccan/build_assert/build_assert.h" /** * ARRAY_SIZE - get the number of elements in a visible array diff --git a/ccan/ccan/container_of/container_of.h b/ccan/ccan/container_of/container_of.h @@ -4,7 +4,7 @@ #include <stddef.h> #include "../config.h" -#include "check_type.h" +#include "ccan/check_type/check_type.h" /** * container_of - get pointer to enclosing structure diff --git a/ccan/ccan/crypto/sha256/sha256.c b/ccan/ccan/crypto/sha256/sha256.c @@ -7,8 +7,8 @@ * file COPYING or http://www.opensource.org/licenses/mit-license.php. */ #include "sha256.h" -#include "endian.h" -#include "compiler.h" +#include "ccan/endian/endian.h" +#include "ccan/compiler/compiler.h" #include <stdbool.h> #include <assert.h> #include <string.h> diff --git a/ccan/ccan/list/list.h b/ccan/ccan/list/list.h @@ -5,8 +5,8 @@ #include <stdbool.h> #include <assert.h> #include "str.h" -#include "container_of.h" -#include "check_type.h" +#include "ccan/container_of/container_of.h" +#include "ccan/check_type/check_type.h" /** * struct list_node - an entry in a doubly-linked list diff --git a/ccan/ccan/mem/mem.h b/ccan/ccan/mem/mem.h @@ -3,7 +3,7 @@ #define CCAN_MEM_H #include "../config.h" -#include "../compiler.h" +#include "ccan/compiler/compiler.h" #include <string.h> #include <stdbool.h> diff --git a/ccan/ccan/structeq/structeq.h b/ccan/ccan/structeq/structeq.h @@ -1,8 +1,8 @@ /* MIT (BSD) license - see LICENSE file for details */ #ifndef CCAN_STRUCTEQ_H #define CCAN_STRUCTEQ_H -#include "build_assert.h" -#include "cppmagic.h" +#include "ccan/build_assert/build_assert.h" +#include "ccan/cppmagic/cppmagic.h" #include <string.h> #include <stdbool.h> diff --git a/ccan/ccan/take/take.c b/ccan/ccan/take/take.c @@ -1,6 +1,6 @@ /* CC0 (Public domain) - see LICENSE file for details */ #include "take.h" -#include "likely.h" +#include "ccan/likely/likely.h" #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/ccan/ccan/tal/str/str.c b/ccan/ccan/tal/str/str.c @@ -4,7 +4,6 @@ #include <string.h> #include <limits.h> #include <stdlib.h> -#include "talstr.h" #include <sys/types.h> #include <regex.h> #include <stdarg.h> diff --git a/ccan/ccan/tal/str/str.h b/ccan/ccan/tal/str/str.h @@ -4,7 +4,7 @@ #ifdef TAL_USE_TALLOC #include <ccan/tal/talloc/talloc.h> #else -#include "tal.h" +#include "ccan/tal/tal.h" #endif #include <string.h> #include <stdbool.h> diff --git a/ccan/ccan/tal/tal.c b/ccan/ccan/tal/tal.c @@ -1,8 +1,8 @@ /* Licensed under BSD-MIT - see LICENSE file for details */ #include "tal.h" -#include "../compiler.h" -#include "list.h" -#include "alignof.h" +#include "ccan/compiler/compiler.h" +#include "ccan/list/list.h" +#include "ccan/alignof/alignof.h" #include <assert.h> #include <stdio.h> diff --git a/ccan/ccan/tal/tal.h b/ccan/ccan/tal/tal.h @@ -2,11 +2,11 @@ #ifndef CCAN_TAL_H #define CCAN_TAL_H #include "../config.h" -#include "../compiler.h" -#include "likely.h" -#include "typesafe_cb.h" -#include "str.h" -#include "take.h" +#include "ccan/compiler/compiler.h" +#include "ccan/likely/likely.h" +#include "ccan/typesafe_cb/typesafe_cb.h" +#include "ccan/str/str.h" +#include "ccan/take/take.h" #include <stdlib.h> #include <stdbool.h> diff --git a/src/bolt11/amount.c b/src/bolt11/amount.c @@ -1,9 +1,9 @@ #include "../config.h" -#include <assert.h> -#include "mem.h" -#include "talstr.h" +#include "ccan/mem/mem.h" +#include "ccan/tal/str/str.h" #include "amount.h" #include "overflows.h" +#include <assert.h> #include <inttypes.h> bool amount_sat_to_msat(struct amount_msat *msat, diff --git a/src/bolt11/amount.h b/src/bolt11/amount.h @@ -1,8 +1,8 @@ #ifndef LIGHTNING_COMMON_AMOUNT_H #define LIGHTNING_COMMON_AMOUNT_H #include "../config.h" -#include "short_types.h" -#include "tal.h" +#include "ccan/short_types/short_types.h" +#include "ccan/tal/tal.h" #define MSAT_PER_SAT ((u64)1000) #define SAT_PER_BTC ((u64)100000000) diff --git a/src/bolt11/bech32_util.h b/src/bolt11/bech32_util.h @@ -2,7 +2,7 @@ #define LIGHTNING_COMMON_BECH32_UTIL_H #include "../config.h" -#include "tal.h" +#include "ccan/tal/tal.h" #include "hash_u5.h" /** diff --git a/src/bolt11/bolt11.c b/src/bolt11/bolt11.c @@ -10,18 +10,18 @@ //#include "address.h" //#include "script.h" #include "bech32.h" -#include "utf8.h" -#include "../compiler.h" -#include "../endian.h" -#include "list.h" -#include "talstr.h" -#include "tal.h" +#include "ccan/utf8/utf8.h" +#include "ccan/compiler//compiler.h" +#include "ccan/endian/endian.h" +#include "ccan/list/list.h" +#include "ccan/tal/str/str.h" +#include "ccan/tal/tal.h" #include "node_id.h" #include "bech32_util.h" #include "bolt11.h" #include "amount.h" -#include "array_size.h" -#include "structeq.h" +#include "ccan/array_size/array_size.h" +#include "ccan/structeq/structeq.h" //#include "features.h" #include <errno.h> diff --git a/src/bolt11/bolt11.h b/src/bolt11/bolt11.h @@ -1,10 +1,10 @@ #ifndef LIGHTNING_COMMON_BOLT11_H #define LIGHTNING_COMMON_BOLT11_H -#include "short_types.h" +#include "ccan/short_types/short_types.h" #include "hash_u5.h" #include "amount.h" -#include "list.h" +#include "ccan/list/list.h" #include "amount.h" #include "node_id.h" //#include <secp256k1_recovery.h> diff --git a/src/bolt11/hash_u5.c b/src/bolt11/hash_u5.c @@ -1,5 +1,6 @@ #include "../config.h" -#include "../endian.h" +#include "ccan/endian/endian.h" +#include "ccan/short_types/short_types.h" #include "hash_u5.h" #include <string.h> diff --git a/src/bolt11/hash_u5.h b/src/bolt11/hash_u5.h @@ -1,8 +1,8 @@ /* bech32 (thus bolt11) deal in 5-bit values */ #ifndef LIGHTNING_COMMON_HASH_U5_H #define LIGHTNING_COMMON_HASH_U5_H -#include "../sha256.h" -#include "short_types.h" +#include "ccan/crypto/sha256/sha256.h" +#include "ccan/short_types/short_types.h" /* Type to annotate a 5 bit value. */ typedef unsigned char u5; diff --git a/src/bolt11/node_id.h b/src/bolt11/node_id.h @@ -2,8 +2,8 @@ #ifndef LIGHTNING_COMMON_NODE_ID_H #define LIGHTNING_COMMON_NODE_ID_H #include "../config.h" -#include "short_types.h" -#include "tal.h" +#include "ccan/short_types/short_types.h" +#include "ccan/tal/tal.h" struct node_id { u8 k[33]; diff --git a/src/bolt11/overflows.h b/src/bolt11/overflows.h @@ -1,7 +1,7 @@ #ifndef LIGHTNING_COMMON_OVERFLOWS_H #define LIGHTNING_COMMON_OVERFLOWS_H #include "../config.h" -#include "short_types.h" +#include "ccan/short_types/short_types.h" static inline bool add_overflows_size_t(uint64_t a, uint64_t b) { diff --git a/src/nostrdb.c b/src/nostrdb.c @@ -4,7 +4,7 @@ #include "hex.h" #include "cursor.h" #include "random.h" -#include "sha256.h" +#include "ccan/crypto/sha256/sha256.h" #include "bolt11/bolt11.h" #include "bolt11/amount.h" #include "lmdb.h"