Merge pull request #2095 from profanity-im/morefixes

Add more compiler flags
This commit is contained in:
Michael Vetter
2026-02-28 10:34:33 +01:00
committed by GitHub
5 changed files with 22 additions and 14 deletions

View File

@@ -39,7 +39,7 @@ tests=(
if [[ "$(uname | tr '[:upper:]' '[:lower:]')" == linux* ]]; then if [[ "$(uname | tr '[:upper:]' '[:lower:]')" == linux* ]]; then
echo "--> Running Valgrind check with full features" echo "--> Running Valgrind check with full features"
meson setup build_valgrind ${tests[0]} -Dtests=true meson setup build_valgrind ${tests[0]} -Dtests=true -Db_sanitize=address,undefined
meson compile -C build_valgrind meson compile -C build_valgrind
meson test -C build_valgrind --print-errorlogs --wrap=valgrind || echo "Valgrind issues detected" meson test -C build_valgrind --print-errorlogs --wrap=valgrind || echo "Valgrind issues detected"

View File

@@ -67,7 +67,8 @@ if is_debug
'-Wextra', '-Wextra',
'-fstack-protector-strong', '-fstack-protector-strong',
'-D_FORTIFY_SOURCE=2', '-D_FORTIFY_SOURCE=2',
'-Og' '-Og',
'-Wpointer-arith'
], language: 'c') ], language: 'c')
if cc.get_id() == 'gcc' if cc.get_id() == 'gcc'
add_project_arguments('-fanalyzer', language: 'c') add_project_arguments('-fanalyzer', language: 'c')

View File

@@ -1545,6 +1545,10 @@ cmd_ac_remove_form_fields(DataForm* form)
char* char*
cmd_ac_complete(ProfWin* window, const char* const input, gboolean previous) cmd_ac_complete(ProfWin* window, const char* const input, gboolean previous)
{ {
if (!input) {
return NULL;
}
char* found = NULL; char* found = NULL;
// autocomplete command // autocomplete command
if ((strncmp(input, "/", 1) == 0) && (!strchr(input, ' '))) { if ((strncmp(input, "/", 1) == 0) && (!strchr(input, ' '))) {

View File

@@ -86,12 +86,18 @@ get_message_from_editor(gchar* message, gchar** returned_message)
auto_gchar gchar* editor_with_filename = g_strdup_printf("%s %s", editor, filename); auto_gchar gchar* editor_with_filename = g_strdup_printf("%s %s", editor, filename);
auto_gcharv gchar** editor_argv = g_strsplit(editor_with_filename, " ", 0); auto_gcharv gchar** editor_argv = g_strsplit(editor_with_filename, " ", 0);
if (!editor_argv || !editor_argv[0]) {
log_error("[Editor] Failed to parse editor command: %s", editor);
return TRUE;
}
// Fork / exec // Fork / exec
pid_t pid = fork(); pid_t pid = fork();
if (pid == 0) { if (pid == 0) {
int x = execvp(editor_argv[0], editor_argv); if (editor_argv && editor_argv[0]) {
if (x == -1) { int x = execvp(editor_argv[0], editor_argv);
log_error("[Editor] Failed to exec %s", editor); if (x == -1)
log_error("[Editor] Failed to exec %s", editor);
} }
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
} else { } else {

View File

@@ -477,16 +477,13 @@ form_set_value(DataForm* form, const char* const tag, char* value)
while (curr) { while (curr) {
FormField* field = curr->data; FormField* field = curr->data;
if (g_strcmp0(field->var, var) == 0) { if (g_strcmp0(field->var, var) == 0) {
if (g_slist_length(field->values) == 0) { if (field->values) {
field->values = g_slist_append(field->values, strdup(value)); g_slist_free_full(field->values, free);
form->modified = TRUE; field->values = NULL;
return;
} else if (g_slist_length(field->values) == 1) {
free(field->values->data);
field->values->data = strdup(value);
form->modified = TRUE;
return;
} }
field->values = g_slist_append(NULL, strdup(value));
form->modified = TRUE;
return;
} }
curr = g_slist_next(curr); curr = g_slist_next(curr);
} }