fix(lib): eliminate remaining lib compiler warnings

- Fix snprintf truncation in MySQL_Monitor ConsumerThread (%.15s for 16-byte buffer)
- Mark unused safe_update_peer_info in ProxySQL_Cluster with __attribute__((unused))
- Remove unused start_time in GenAI_Thread::generate_embeddings
- Remove unused now_iso() in Discovery_Schema
lint-tap-tests-static-analysis
Rene Cannao 1 month ago
parent 41956b8f4a
commit fe89811324

@ -13,15 +13,6 @@
using json = nlohmann::json;
// Helper function for current timestamp
static std::string now_iso() {
char buf[64];
time_t now = time(NULL);
struct tm* tm_info = gmtime(&now);
strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%SZ", tm_info);
return std::string(buf);
}
Discovery_Schema::Discovery_Schema(const std::string& path)
: db(NULL), db_path(path), mcp_rules_version(0)
{

@ -973,8 +973,6 @@ GenAI_EmbeddingResult GenAI_Threads_Handler::call_llama_batch_embedding(const st
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
// Perform request
auto start_time = std::chrono::steady_clock::now();
CURLcode res = curl_easy_perform(curl);
if (res != CURLE_OK) {

@ -109,7 +109,7 @@ class ConsumerThread : public Thread {
ConsumerThread(wqueue<WorkItem<T>*>& queue, int _n, const char *thread_name=NULL) : m_queue(queue) {
thrn=_n;
if (thread_name && thread_name[0]) {
snprintf(thr_name, sizeof(thr_name), "%.16s", thread_name);
snprintf(thr_name, sizeof(thr_name), "%.15s", thread_name);
} else {
snprintf(thr_name, sizeof(thr_name), "%.12s%03d", typeid(T).name(), thrn);
}

@ -122,7 +122,7 @@ static char *NODE_COMPUTE_DELIMITER=(char *)"-gtyw23a-"; // a random string used
*
* @return Returns true if allocation succeeded, false on memory allocation failure
*/
static bool safe_update_peer_info(char** existing_hostname, char** existing_ip_addr,
static bool __attribute__((unused)) safe_update_peer_info(char** existing_hostname, char** existing_ip_addr,
const char* new_hostname, const char* new_ip_addr) {
// Free existing allocations
if (*existing_hostname) {

Loading…
Cancel
Save