core: Avoid trivial snprintfs.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 34m10s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 34m10s
This commit is contained in:
@ -241,7 +241,7 @@ static JSValue _tf_ssb_deleteIdentity(JSContext* context, JSValueConst this_val,
|
||||
{
|
||||
delete_identity_t* work = tf_malloc(sizeof(delete_identity_t) + user_length + 1);
|
||||
*work = (delete_identity_t) { 0 };
|
||||
snprintf(work->id, sizeof(work->id), "%s", *id == '@' ? id + 1 : id);
|
||||
tf_string_set(work->id, sizeof(work->id), *id == '@' ? id + 1 : id);
|
||||
memcpy(work->user, user, user_length + 1);
|
||||
result = JS_NewPromiseCapability(context, work->promise);
|
||||
tf_ssb_run_work(ssb, _tf_ssb_delete_identity_work, _tf_ssb_delete_identity_after_work, work);
|
||||
@ -353,7 +353,7 @@ static JSValue _tf_ssb_swap_with_server_identity(JSContext* context, JSValueCons
|
||||
swap_with_server_identity_t* work = tf_malloc(sizeof(swap_with_server_identity_t) + user_length + 1);
|
||||
*work = (swap_with_server_identity_t) { 0 };
|
||||
tf_ssb_whoami(ssb, work->server_id, sizeof(work->server_id));
|
||||
snprintf(work->id, sizeof(work->id), "%s", id);
|
||||
tf_string_set(work->id, sizeof(work->id), id);
|
||||
memcpy(work->user, user, user_length + 1);
|
||||
result = JS_NewPromiseCapability(context, work->promise);
|
||||
tf_ssb_run_work(ssb, _tf_ssb_swap_with_server_identity_work, _tf_ssb_swap_with_server_identity_after_work, work);
|
||||
@ -489,7 +489,7 @@ static JSValue _tf_ssb_getPrivateKey(JSContext* context, JSValueConst this_val,
|
||||
get_private_key_t* work = tf_malloc(sizeof(get_private_key_t) + user_length + 1);
|
||||
*work = (get_private_key_t) { .context = context };
|
||||
memcpy(work->user, user, user_length + 1);
|
||||
snprintf(work->id, sizeof(work->id), "%s", id);
|
||||
tf_string_set(work->id, sizeof(work->id), id);
|
||||
JSValue result = JS_NewPromiseCapability(context, work->promise);
|
||||
tf_ssb_run_work(ssb, _tf_ssb_get_private_key_work, _tf_ssb_get_private_key_after_work, work);
|
||||
|
||||
@ -766,7 +766,7 @@ static JSValue _tf_ssb_appendMessageWithIdentity(JSContext* context, JSValueCons
|
||||
append_message_t* work = tf_malloc(sizeof(append_message_t) + user_length + 1);
|
||||
*work = (append_message_t) { .context = context, .message = JS_DupValue(context, argv[2]) };
|
||||
memcpy(work->user, user, user_length + 1);
|
||||
snprintf(work->id, sizeof(work->id), "%s", id);
|
||||
tf_string_set(work->id, sizeof(work->id), id);
|
||||
|
||||
JS_FreeCString(context, id);
|
||||
JS_FreeCString(context, user);
|
||||
|
Reference in New Issue
Block a user