From 6c26399269888382805e27f8cfbe56a619e39434 Mon Sep 17 00:00:00 2001 From: Sheldon Robinson Date: Fri, 9 Aug 2024 13:26:45 -0400 Subject: [PATCH] Fix compilation error for redefinition of jsonIsspace (#75) * Fix compilation error for redefinition of jsonIsspace when including in amalgamation build of sqlite3.c * Fix redefinition variable jsonIsSpaceX[] * Add check for SQLITE_AMALGMATION * Add check for SQLITE_CORE --- sqlite-vec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sqlite-vec.c b/sqlite-vec.c index 5355845..7ab7e9e 100644 --- a/sqlite-vec.c +++ b/sqlite-vec.c @@ -546,6 +546,7 @@ static f32 distance_hamming(const void *a, const void *b, const void *d) { return distance_hamming_u8((u8 *)a, (u8 *)b, dimensions / CHAR_BIT); } +#if !defined(SQLITE_CORE) || (defined(SQLITE_AMALGAMATION) && defined(SQLITE_OMIT_JSON)) // from SQLite source: // https://github.com/sqlite/sqlite/blob/a509a90958ddb234d1785ed7801880ccb18b497e/src/json.c#L153 static const char jsonIsSpaceX[] = { @@ -563,7 +564,9 @@ static const char jsonIsSpaceX[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + #define jsonIsspace(x) (jsonIsSpaceX[(unsigned char)x]) +#endif typedef void (*vector_cleanup)(void *p);