core: Avoid trivial snprintfs.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 34m10s

This commit is contained in:
2025-06-10 21:17:55 -04:00
parent 3a2a829940
commit b135a210cc
13 changed files with 96 additions and 74 deletions

View File

@ -61,9 +61,9 @@ static bool _tf_ssb_connections_get_next_connection(tf_ssb_connections_t* connec
{
if (sqlite3_bind_int(statement, 1, 60000) == SQLITE_OK && sqlite3_step(statement) == SQLITE_ROW)
{
snprintf(host, host_size, "%s", sqlite3_column_text(statement, 0));
tf_string_set(host, host_size, (const char*)sqlite3_column_text(statement, 0));
*port = sqlite3_column_int(statement, 1);
snprintf(key, key_size, "%s", sqlite3_column_text(statement, 2));
tf_string_set(key, key_size, (const char*)sqlite3_column_text(statement, 2));
result = true;
}
sqlite3_finalize(statement);
@ -246,8 +246,8 @@ void tf_ssb_connections_store(tf_ssb_connections_t* connections, const char* hos
*update = (tf_ssb_connections_update_t) {
.port = port,
};
snprintf(update->host, sizeof(update->host), "%s", host);
snprintf(update->key, sizeof(update->key), "%s", key);
tf_string_set(update->host, sizeof(update->host), host);
tf_string_set(update->key, sizeof(update->key), key);
_tf_ssb_connections_queue_update(connections, update);
}
@ -258,8 +258,8 @@ void tf_ssb_connections_set_attempted(tf_ssb_connections_t* connections, const c
.port = port,
.attempted = true,
};
snprintf(update->host, sizeof(update->host), "%s", host);
snprintf(update->key, sizeof(update->key), "%s", key);
tf_string_set(update->host, sizeof(update->host), host);
tf_string_set(update->key, sizeof(update->key), key);
_tf_ssb_connections_queue_update(connections, update);
}
@ -270,8 +270,8 @@ void tf_ssb_connections_set_succeeded(tf_ssb_connections_t* connections, const c
.port = port,
.succeeded = true,
};
snprintf(update->host, sizeof(update->host), "%s", host);
snprintf(update->key, sizeof(update->key), "%s", key);
tf_string_set(update->host, sizeof(update->host), host);
tf_string_set(update->key, sizeof(update->key), key);
_tf_ssb_connections_queue_update(connections, update);
}