Skip to content

Commit

Permalink
Fix compilation error for redefinition of jsonIsspace (#75)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sheldonrobinson authored Aug 9, 2024
1 parent 6cccfae commit 6c26399
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sqlite-vec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand All @@ -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);

Expand Down

0 comments on commit 6c26399

Please sign in to comment.