Skip to content

Commit 092991e

Browse files
committed
Minor fixes
1 parent b20f12f commit 092991e

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

src/sqlite-memory.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,20 @@ struct dbmem_context {
141141
char error_msg[DBMEM_ERRBUF_SIZE]; // Error message buffer
142142
};
143143

144-
static bool fts5_is_available = true;
144+
// MARK: - Internal prototypes
145+
146+
typedef struct dbmem_string_list dbmem_string_list;
147+
typedef struct dbmem_json_buffer dbmem_json_buffer;
145148

149+
static int dbmem_database_begin_transaction (sqlite3 *db);
150+
static int dbmem_database_commit_transaction (sqlite3 *db);
151+
static int dbmem_database_rollback_transaction (sqlite3 *db);
152+
static int dbmem_json_append_tree_children (dbmem_json_buffer *json, dbmem_string_list *paths, int start, int end, size_t offset);
146153
static char *dbmem_path_normalized_copy (const char *path);
154+
static char *dbmem_path_unique_storage_copy (sqlite3 *db, const char *preferred_path, const char *source_path);
155+
static int dbmem_reindex (dbmem_context *ctx);
156+
157+
static bool fts5_is_available = true;
147158

148159
static int dbmem_bind_hash (sqlite3_stmt *vm, int index, uint64_t hash) {
149160
char hash_text[DBMEM_HASH_STR_MAXLEN];
@@ -482,10 +493,6 @@ static int dbmem_database_set_schema_version (sqlite3 *db, int version) {
482493
return dbmem_settings_write_int(db, DBMEM_SETTINGS_KEY_SCHEMA_VERSION, version);
483494
}
484495

485-
static int dbmem_database_begin_transaction (sqlite3 *db);
486-
static int dbmem_database_commit_transaction (sqlite3 *db);
487-
static int dbmem_database_rollback_transaction (sqlite3 *db);
488-
489496
static int dbmem_database_migrate_v1_to_v2 (sqlite3 *db) {
490497
int rc = dbmem_database_add_column_if_missing(db, "dbmem_vault", "n_tokens",
491498
"ALTER TABLE dbmem_vault ADD COLUMN n_tokens INTEGER NOT NULL DEFAULT 0;");
@@ -1510,17 +1517,17 @@ static void dbmem_rename_file (sqlite3_context *context, int argc, sqlite3_value
15101517

15111518
// MARK: - Path Listing -
15121519

1513-
typedef struct {
1520+
struct dbmem_string_list {
15141521
char **items;
15151522
int count;
15161523
int capacity;
1517-
} dbmem_string_list;
1524+
};
15181525

1519-
typedef struct {
1526+
struct dbmem_json_buffer {
15201527
char *data;
15211528
size_t length;
15221529
size_t capacity;
1523-
} dbmem_json_buffer;
1530+
};
15241531

15251532
static bool dbmem_path_separator (char c) {
15261533
return c == '/' || c == '\\';
@@ -1822,8 +1829,6 @@ static int dbmem_json_append_file_node (dbmem_json_buffer *json, const char *pat
18221829
return dbmem_json_buffer_append_char(json, '}');
18231830
}
18241831

1825-
static int dbmem_json_append_tree_children (dbmem_json_buffer *json, dbmem_string_list *paths, int start, int end, size_t offset);
1826-
18271832
static int dbmem_json_append_directory_node (dbmem_json_buffer *json, dbmem_string_list *paths, int start, int end, size_t offset) {
18281833
const char *path = paths->items[start];
18291834
size_t segment_start = dbmem_path_segment_start(path, offset);
@@ -2018,8 +2023,6 @@ static void dbmem_version (sqlite3_context *context, int argc, sqlite3_value **a
20182023
sqlite3_result_text(context, SQLITE_DBMEMORY_VERSION, -1, NULL);
20192024
}
20202025

2021-
static int dbmem_reindex(dbmem_context *ctx);
2022-
20232026
static void dbmem_set_model (sqlite3_context *context, int argc, sqlite3_value **argv) {
20242027
// 2 TEXT arguments: provider and model
20252028

@@ -2612,8 +2615,6 @@ static int dbmem_process_callback (const char *text, size_t len, size_t offset,
26122615
return rc;
26132616
}
26142617

2615-
static char *dbmem_path_unique_storage_copy (sqlite3 *db, const char *preferred_path, const char *source_path);
2616-
26172618
static int dbmem_process_buffer (dbmem_context *ctx, const char *buffer, int64_t len) {
26182619
uint64_t hash = dbmem_hash_compute(buffer, (size_t)len);
26192620
const char *saved_path = ctx->path;

0 commit comments

Comments
 (0)