diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-06-12 16:12:21 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-06-12 16:12:21 +0200 |
commit | 74e061165a808883c5b17ff356bde60fa335cbda (patch) | |
tree | f0cb35ac30ee9fb90a00ba0e93ec4e84326979bc /src/ui | |
parent | f1141932fc45fa4bcc87984241b524381c0ab2b3 (diff) | |
download | profani-tty-74e061165a808883c5b17ff356bde60fa335cbda.tar.gz |
Define POSIX macro to have strdup
https://github.com/profanity-im/profanity/commit/98c38dc6d6d29333c63f80327774f094610d8602 sets C99 as standard. strdup() is not part of C99. For now set `-D_POSIX_C_SOURCE=200809L` macro to have strdup() in C99. Using `gnu99` instead would be another option. We should take more care to use glib functions whenever possible. Regards https://github.com/profanity-im/profanity/issues/1357
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/inputwin.c | 4 | ||||
-rw-r--r-- | src/ui/tray.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index f3383986..6a1a6f48 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -503,10 +503,10 @@ _inp_rl_startup_hook(void) rl_variable_bind("disable-completion", "on"); // check for and load ~/.config/profanity/inputrc - char *inputrc = files_get_inputrc_file(); + gchar *inputrc = files_get_inputrc_file(); if (inputrc) { rl_read_init_file(inputrc); - free(inputrc); + g_free(inputrc); } return 0; diff --git a/src/ui/tray.c b/src/ui/tray.c index d327fc1c..6d79b379 100644 --- a/src/ui/tray.c +++ b/src/ui/tray.c @@ -79,13 +79,15 @@ _get_icons(void) #endif /* ICONS_PATH */ - char *icons_dir_s = files_get_config_path(DIR_ICONS); + gchar *icons_dir_s = files_get_config_path(DIR_ICONS); icons_dir = g_string_new(icons_dir_s); - free(icons_dir_s); + g_free(icons_dir_s); GError *err = NULL; + if (!g_file_test(icons_dir->str, G_FILE_TEST_IS_DIR)) { return; } + GDir *dir = g_dir_open(icons_dir->str, 0, &err); if (dir) { GString *name = g_string_new(g_dir_read_name(dir)); |