Skip to content

Commit

Permalink
Fix cppcheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
techee committed May 11, 2024
1 parent a0e0fde commit 884c520
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lsp/src/lsp-autocomplete.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ static void process_response(LspServer *server, GVariant *response, GeanyDocumen
else
{
g_ptr_array_add(symbols_filtered, sym);
g_hash_table_add(entry_set, g_strdup(display_label));
g_hash_table_insert(entry_set, g_strdup(display_label), NULL);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lsp/src/lsp-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ static gboolean on_editor_notify(G_GNUC_UNUSED GObject *obj, GeanyEditor *editor
{
LspPosition pos_start = lsp_utils_scintilla_pos_to_lsp(sci, nt->position);
LspPosition pos_end = pos_start;
gchar *text = malloc(nt->length + 1);
gchar *text = g_malloc(nt->length + 1);

memcpy(text, nt->text, nt->length);
text[nt->length] = '\0';
Expand Down
2 changes: 1 addition & 1 deletion lsp/src/lsp-semtokens.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ static gchar *process_tokens(GArray *tokens, GeanyDocument *doc, guint64 token_m

str = sci_get_contents_range(sci, sci_pos_start, sci_pos_end);
if (str)
g_hash_table_add(type_table, str);
g_hash_table_insert(type_table, str, NULL);
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions lsp/src/lsp-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,13 +1053,15 @@ gboolean lsp_server_uses_init_file(gchar *path)

gchar *lsp_server_get_initialize_responses(void)
{
GString *str = g_string_new("{");
guint i;
gboolean first = TRUE;
GString *str;
guint i;

if (!lsp_servers)
return FALSE;

str = g_string_new("{");

for (i = 0; i < lsp_servers->len; i++)
{
LspServer *s = lsp_servers->pdata[i];
Expand Down

0 comments on commit 884c520

Please sign in to comment.