From 0a35e14590d24bd4383f1092f3c5f47268452cab Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 23 Oct 2024 21:50:34 -0400 Subject: [PATCH] js: Fix database.getall(). --- src/database.js.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/database.js.c b/src/database.js.c index 6742aa7c..1c67bb5a 100644 --- a/src/database.js.c +++ b/src/database.js.c @@ -390,8 +390,6 @@ static JSValue _database_remove(JSContext* context, JSValueConst this_val, int a typedef struct _database_get_all_t { const char* id; - const char* key; - size_t key_length; char** out_values; size_t* out_lengths; int out_values_length; @@ -455,17 +453,11 @@ static JSValue _database_get_all(JSContext* context, JSValueConst this_val, int { tf_ssb_t* ssb = tf_task_get_ssb(database->task); - size_t length; - const char* key = JS_ToCStringLen(context, &length, argv[0]); - database_get_all_t* work = tf_malloc(sizeof(database_get_all_t) + strlen(database->id) + 1 + length + 1); + database_get_all_t* work = tf_malloc(sizeof(database_get_all_t) + strlen(database->id) + 1); *work = (database_get_all_t) { .id = (const char*)(work + 1), - .key = (const char*)(work + 1) + strlen(database->id) + 1, - .key_length = length, }; memcpy((char*)work->id, database->id, strlen(database->id) + 1); - memcpy((char*)work->key, key, length + 1); - JS_FreeCString(context, key); tf_ssb_run_work(ssb, _database_get_all_work, _database_get_all_after_work, work); result = JS_NewPromiseCapability(context, work->promise);