Define POSIX macro to have strdup

98c38dc6d6
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
This commit is contained in:
Michael Vetter
2020-06-12 16:12:21 +02:00
parent f1141932fc
commit 74e061165a
8 changed files with 28 additions and 25 deletions

View File

@@ -230,10 +230,11 @@ GSList*
theme_list(void)
{
GSList *result = NULL;
char *themes_dir = files_get_config_path(DIR_THEMES);
gchar *themes_dir = files_get_config_path(DIR_THEMES);
_theme_list_dir(themes_dir, &result);
free(themes_dir);
g_free(themes_dir);
#ifdef THEMES_PATH
_theme_list_dir(THEMES_PATH, &result);
#endif
@@ -532,11 +533,11 @@ static GString*
_theme_find(const char *const theme_name)
{
GString *path = NULL;
char *themes_dir = files_get_config_path(DIR_THEMES);
gchar *themes_dir = files_get_config_path(DIR_THEMES);
if (themes_dir) {
path = g_string_new(themes_dir);
free(themes_dir);
g_free(themes_dir);
g_string_append(path, "/");
g_string_append(path, theme_name);
if (!g_file_test(path->str, G_FILE_TEST_EXISTS)) {