commit 2f60888fb1853c480593462e4ff6e7a079ce6d94
parent ba6792640d108b71b1e86bc0a33a53c7f17b8852
Author: William Casarin <jb55@jb55.com>
Date: Mon, 28 Aug 2023 08:18:25 -0700
ndb: remove patch from copy script, just use sed
Diffstat:
2 files changed, 3 insertions(+), 290 deletions(-)
diff --git a/nostrdb/copy-ndb b/nostrdb/copy-ndb
@@ -10,4 +10,6 @@ cp ~/src/c/nostrdb/deps/lmdb/midl.c .
cp -r ~/src/c/nostrdb/deps/flatcc/include/flatcc/* flatcc
cp ~/src/c/nostrdb/deps/flatcc/src/runtime/* flatcc
cp -r ~/src/c/nostrdb/bindings .
-patch -p2 < flatcc.patch
+#patch -p2 < flatcc.patch
+sed -i"" 's,import FlatBuffers,,' bindings/swift/NdbProfile.swift
+sed -i"" 's,^#include "flatcc/,#include ",g' bindings/c/*.h flatcc/*.{c,h}
diff --git a/nostrdb/flatcc.patch b/nostrdb/flatcc.patch
@@ -1,289 +0,0 @@
-diff --git b/nostrdb/bindings/c/flatbuffers_common_reader.h a/nostrdb/bindings/c/flatbuffers_common_reader.h
-index c575308689b9..49e479e29980 100644
---- b/nostrdb/bindings/c/flatbuffers_common_reader.h
-+++ a/nostrdb/bindings/c/flatbuffers_common_reader.h
-@@ -5,8 +5,8 @@
-
- /* Common FlatBuffers read functionality for C. */
-
--#include "flatcc/flatcc_prologue.h"
--#include "flatcc/flatcc_flatbuffers.h"
-+#include "flatcc_prologue.h"
-+#include "flatcc_flatbuffers.h"
-
-
- #define __flatbuffers_read_scalar_at_byteoffset(N, p, o) N ## _read_from_pe((uint8_t *)(p) + (o))
-@@ -574,5 +574,5 @@ static inline N ## _ ## K ## t N ## _as_typed_root(const void *buffer__tmp)\
- #define __flatbuffers_struct_as_root(N) __flatbuffers_buffer_as_root(N, struct_)
- #define __flatbuffers_table_as_root(N) __flatbuffers_buffer_as_root(N, table_)
-
--#include "flatcc/flatcc_epilogue.h"
-+#include "flatcc_epilogue.h"
- #endif /* FLATBUFFERS_COMMON_H */
-diff --git b/nostrdb/bindings/c/profile_json_parser.h a/nostrdb/bindings/c/profile_json_parser.h
-index a7caaaec6d37..f404b6679fe0 100644
---- b/nostrdb/bindings/c/profile_json_parser.h
-+++ a/nostrdb/bindings/c/profile_json_parser.h
-@@ -3,8 +3,8 @@
-
- /* Generated by flatcc 0.6.1 FlatBuffers schema compiler for C by dvide.com */
-
--#include "flatcc/flatcc_json_parser.h"
--#include "flatcc/flatcc_prologue.h"
-+#include "flatcc_json_parser.h"
-+#include "flatcc_prologue.h"
-
- /*
- * Parses the default root table or struct of the schema and constructs a FlatBuffer.
-@@ -280,5 +280,5 @@ static int profile_parse_json(flatcc_builder_t *B, flatcc_json_parser_t *ctx,
- return 0;
- }
-
--#include "flatcc/flatcc_epilogue.h"
-+#include "flatcc_epilogue.h"
- #endif /* PROFILE_JSON_PARSER_H */
-diff --git b/nostrdb/flatcc/builder.c a/nostrdb/flatcc/builder.c
-index 9f54d884ff53..c5155a85e407 100644
---- b/nostrdb/flatcc/builder.c
-+++ a/nostrdb/flatcc/builder.c
-@@ -16,8 +16,8 @@
- #include <stdlib.h>
- #include <string.h>
-
--#include "flatcc/flatcc_builder.h"
--#include "flatcc/flatcc_emitter.h"
-+#include "flatcc_builder.h"
-+#include "flatcc_emitter.h"
-
- /*
- * `check` is designed to handle incorrect use errors that can be
-diff --git b/nostrdb/flatcc/emitter.c a/nostrdb/flatcc/emitter.c
-index 089ea00b2060..dbeffacd97ed 100644
---- b/nostrdb/flatcc/emitter.c
-+++ a/nostrdb/flatcc/emitter.c
-@@ -1,7 +1,7 @@
- #include <stdlib.h>
-
--#include "flatcc/flatcc_rtconfig.h"
--#include "flatcc/flatcc_emitter.h"
-+#include "flatcc_rtconfig.h"
-+#include "flatcc_emitter.h"
-
- static int advance_front(flatcc_emitter_t *E)
- {
-diff --git b/nostrdb/flatcc/flatcc_alloc.h a/nostrdb/flatcc/flatcc_alloc.h
-index 155364c1e2ba..c07462d57754 100644
---- b/nostrdb/flatcc/flatcc_alloc.h
-+++ a/nostrdb/flatcc/flatcc_alloc.h
-@@ -69,7 +69,7 @@ extern "C" {
- #ifndef FLATCC_USE_GENERIC_ALIGNED_ALLOC
-
- #ifndef FLATCC_NO_PALIGNED_ALLOC
--#include "flatcc/portable/paligned_alloc.h"
-+#include "paligned_alloc.h"
- #else
- #if !defined(__aligned_free_is_defined) || !__aligned_free_is_defined
- #define aligned_free free
-diff --git b/nostrdb/flatcc/flatcc_emitter.h a/nostrdb/flatcc/flatcc_emitter.h
-index b8c83b94d3de..11756f23f4d0 100644
---- b/nostrdb/flatcc/flatcc_emitter.h
-+++ a/nostrdb/flatcc/flatcc_emitter.h
-@@ -16,9 +16,9 @@ extern "C" {
- #include <stdlib.h>
- #include <string.h>
-
--#include "flatcc/flatcc_types.h"
--#include "flatcc/flatcc_iov.h"
--#include "flatcc/flatcc_alloc.h"
-+#include "flatcc_types.h"
-+#include "flatcc_iov.h"
-+#include "flatcc_alloc.h"
-
- /*
- * The buffer steadily grows during emission but the design allows for
-diff --git b/nostrdb/flatcc/flatcc_endian.h a/nostrdb/flatcc/flatcc_endian.h
-index 0592f3132380..d16f72c89a11 100644
---- b/nostrdb/flatcc/flatcc_endian.h
-+++ a/nostrdb/flatcc/flatcc_endian.h
-@@ -66,7 +66,7 @@ extern "C" {
- #define htobe8(n) (n)
- #endif
-
--#include "flatcc/flatcc_accessors.h"
-+#include "flatcc_accessors.h"
-
- /* This is the binary encoding endianness, usually LE for flatbuffers. */
- #if FLATBUFFERS_PROTOCOL_IS_LE
-diff --git b/nostrdb/flatcc/flatcc_epilogue.h a/nostrdb/flatcc/flatcc_epilogue.h
-index 496857ba1251..dc724f6c98ed 100644
---- b/nostrdb/flatcc/flatcc_epilogue.h
-+++ a/nostrdb/flatcc/flatcc_epilogue.h
-@@ -4,5 +4,5 @@
- }
- #endif
-
--#include "flatcc/portable/pdiagnostic_pop.h"
-+#include "pdiagnostic_pop.h"
-
-diff --git b/nostrdb/flatcc/flatcc_flatbuffers.h a/nostrdb/flatcc/flatcc_flatbuffers.h
-index 4bfc7435251a..210c9f2a420d 100644
---- b/nostrdb/flatcc/flatcc_flatbuffers.h
-+++ a/nostrdb/flatcc/flatcc_flatbuffers.h
-@@ -4,7 +4,7 @@
- *
- * Outside include guard to handle scope counter.
- */
--#include "flatcc/portable/pstatic_assert.h"
-+#include "pstatic_assert.h"
-
- #ifndef FLATCC_FLATBUFFERS_H
- #define FLATCC_FLATBUFFERS_H
-@@ -19,15 +19,15 @@ extern "C" {
- #ifdef FLATCC_PORTABLE
- #include "flatcc/flatcc_portable.h"
- #endif
--#include "flatcc/portable/pwarnings.h"
-+#include "pwarnings.h"
- /* Needed by C99 compilers without FLATCC_PORTABLE. */
--#include "flatcc/portable/pstdalign.h"
-+#include "pstdalign.h"
-
- /* Handle fallthrough attribute in switch statements. */
--#include "flatcc/portable/pattributes.h"
-+#include "pattributes.h"
-
--#include "flatcc/flatcc_alloc.h"
--#include "flatcc/flatcc_assert.h"
-+#include "flatcc_alloc.h"
-+#include "flatcc_assert.h"
-
- #define __FLATBUFFERS_PASTE2(a, b) a ## b
- #define __FLATBUFFERS_PASTE3(a, b, c) a ## b ## c
-@@ -37,10 +37,10 @@ extern "C" {
- * "flatcc_endian.h" requires the preceeding include files,
- * or compatible definitions.
- */
--#include "flatcc/portable/pendian.h"
--#include "flatcc/flatcc_types.h"
--#include "flatcc/flatcc_endian.h"
--#include "flatcc/flatcc_identifier.h"
-+#include "pendian.h"
-+#include "flatcc_types.h"
-+#include "flatcc_endian.h"
-+#include "flatcc_identifier.h"
-
- #ifndef FLATBUFFERS_WRAP_NAMESPACE
- #define FLATBUFFERS_WRAP_NAMESPACE(ns, x) ns ## _ ## x
-diff --git b/nostrdb/flatcc/flatcc_json_parser.h a/nostrdb/flatcc/flatcc_json_parser.h
-index 1907fc7fc635..ed7151c2fd6b 100644
---- b/nostrdb/flatcc/flatcc_json_parser.h
-+++ a/nostrdb/flatcc/flatcc_json_parser.h
-@@ -15,12 +15,12 @@ extern "C" {
- #include <stdlib.h>
- #include <string.h>
-
--#include "flatcc/flatcc_rtconfig.h"
--#include "flatcc/flatcc_builder.h"
--#include "flatcc/flatcc_unaligned.h"
-+#include "flatcc_rtconfig.h"
-+#include "flatcc_builder.h"
-+#include "flatcc_unaligned.h"
-
- #define PDIAGNOSTIC_IGNORE_UNUSED
--#include "flatcc/portable/pdiagnostic_push.h"
-+#include "pdiagnostic_push.h"
-
- enum flatcc_json_parser_flags {
- flatcc_json_parser_f_skip_unknown = 1,
-@@ -886,7 +886,7 @@ int flatcc_json_parser_struct_as_root(flatcc_builder_t *B, flatcc_json_parser_t
- const char *buf, size_t bufsiz, int flags, const char *fid,
- flatcc_json_parser_struct_f *parser);
-
--#include "flatcc/portable/pdiagnostic_pop.h"
-+#include "pdiagnostic_pop.h"
-
- #ifdef __cplusplus
- }
-diff --git b/nostrdb/flatcc/flatcc_prologue.h a/nostrdb/flatcc/flatcc_prologue.h
-index 3a74ed6040db..36344c4c071f 100644
---- b/nostrdb/flatcc/flatcc_prologue.h
-+++ a/nostrdb/flatcc/flatcc_prologue.h
-@@ -1,7 +1,7 @@
- /* Include guard intentionally left out. */
-
- #define PDIAGNOSTIC_IGNORE_UNUSED
--#include "flatcc/portable/pdiagnostic_push.h"
-+#include "pdiagnostic_push.h"
-
- #ifdef __cplusplus
- extern "C" {
-diff --git b/nostrdb/flatcc/flatcc_refmap.h a/nostrdb/flatcc/flatcc_refmap.h
-index 062d94f5d35d..beafa301d042 100644
---- b/nostrdb/flatcc/flatcc_refmap.h
-+++ a/nostrdb/flatcc/flatcc_refmap.h
-@@ -50,7 +50,7 @@
- extern "C" {
- #endif
-
--#include "flatcc/flatcc_types.h"
-+#include "flatcc_types.h"
-
- #ifndef FLATCC_REFMAP_MIN_BUCKETS
- /* 8 buckets gives us 5 useful initial entries with a load factor of 0.7 */
-diff --git b/nostrdb/flatcc/flatcc_unaligned.h a/nostrdb/flatcc/flatcc_unaligned.h
-index a7dc546111cd..5ea26cede6ee 100644
---- b/nostrdb/flatcc/flatcc_unaligned.h
-+++ a/nostrdb/flatcc/flatcc_unaligned.h
-@@ -5,7 +5,7 @@
- extern "C" {
- #endif
-
--#include "flatcc/portable/punaligned.h"
-+#include "punaligned.h"
-
- #define FLATCC_ALLOW_UNALIGNED_ACCESS PORTABLE_UNALIGNED_ACCESS
-
-diff --git b/nostrdb/flatcc/json_parser.c a/nostrdb/flatcc/json_parser.c
-index 0e3aeea9834c..06f778da33f3 100644
---- b/nostrdb/flatcc/json_parser.c
-+++ a/nostrdb/flatcc/json_parser.c
-@@ -1,6 +1,6 @@
--#include "flatcc/flatcc_rtconfig.h"
--#include "flatcc/flatcc_json_parser.h"
--#include "flatcc/flatcc_assert.h"
-+#include "flatcc_rtconfig.h"
-+#include "flatcc_json_parser.h"
-+#include "flatcc_assert.h"
-
- #define uoffset_t flatbuffers_uoffset_t
- #define soffset_t flatbuffers_soffset_t
-@@ -16,8 +16,8 @@
- #if FLATCC_USE_GRISU3 && !defined(PORTABLE_USE_GRISU3)
- #define PORTABLE_USE_GRISU3 1
- #endif
--#include "flatcc/portable/pparsefp.h"
--#include "flatcc/portable/pbase64.h"
-+#include "portable/pparsefp.h"
-+#include "portable/pbase64.h"
-
- #if FLATCC_USE_SSE4_2
- #ifdef __SSE4_2__
-diff --git b/nostrdb/flatcc/refmap.c a/nostrdb/flatcc/refmap.c
-index a2497f02247b..d8c6034fbb12 100644
---- b/nostrdb/flatcc/refmap.c
-+++ a/nostrdb/flatcc/refmap.c
-@@ -13,10 +13,10 @@
- #include <stdlib.h>
- #include <string.h>
-
--#include "flatcc/flatcc_rtconfig.h"
--#include "flatcc/flatcc_refmap.h"
--#include "flatcc/flatcc_alloc.h"
--#include "flatcc/flatcc_assert.h"
-+#include "flatcc_rtconfig.h"
-+#include "flatcc_refmap.h"
-+#include "flatcc_alloc.h"
-+#include "flatcc_assert.h"
-
- #define _flatcc_refmap_calloc FLATCC_CALLOC
- #define _flatcc_refmap_free FLATCC_FREE