File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ SQLITE_EXTENSION_INIT3
2929
3030#define FNV_OFFSET_BASIS 0xcbf29ce484222325ULL
3131#define FNV_PRIME 0x100000001b3ULL
32- #define HASH_CHAR (_c ) do { h ^= (uint8_t)(_c); h *= FNV_PRIME; h_final = h; } while (0)
32+ #define HASH_CHAR (_c ) do { h ^= (uint8_t)(_c); h *= FNV_PRIME; h_final = h;} while (0)
3333
3434// MARK: UUIDv7 -
3535
@@ -252,6 +252,20 @@ uint64_t fnv1a_hash (const char *data, size_t len) {
252252
253253 // whitespace normalization
254254 if (isspace ((unsigned char )c )) {
255+ // look ahead to next non-space, non-comment char
256+ size_t j = i + 1 ;
257+ while (j < len && isspace ((unsigned char )data [j ])) j ++ ;
258+
259+ int next_c = (j < len ) ? data [j ] : 0 ;
260+
261+ // if next char is punctuation where space is irrelevant → skip space
262+ if (next_c == '(' || next_c == ')' || next_c == ',' || next_c == ';' || next_c == 0 ) {
263+ // skip inserting space
264+ last_space = 1 ;
265+ continue ;
266+ }
267+
268+ // else, insert one space
255269 if (!last_space ) {HASH_CHAR (' ' ); last_space = 1 ;}
256270 continue ;
257271 }
You can’t perform that action at this time.
0 commit comments