summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@0x90.dk>2014-06-27 14:41:54 +0200
committerAlexander Færøy <ahf@0x90.dk>2014-06-27 14:41:54 +0200
commit113f1724d72724c1bb3e2111c0ce92a3cafd67fa (patch)
tree86f2619c8304a3b2743cb29b41ad32b83bf71517 /src/fe-common
parentb8c2915d79a1e0ccec92e627b716fe0a6af81fc6 (diff)
parent9d6cd87b0f548aba2094504c6ef71aec69f9d7fb (diff)
downloadirssi-113f1724d72724c1bb3e2111c0ce92a3cafd67fa.zip
Merge pull request #44 from dajohi/g_basename
Replace deprecated g_basename with g_path_get_basename.
Diffstat (limited to 'src/fe-common')
-rw-r--r--src/fe-common/core/completion.c7
-rw-r--r--src/fe-common/core/themes.c6
2 files changed, 8 insertions, 5 deletions
diff --git a/src/fe-common/core/completion.c b/src/fe-common/core/completion.c
index db21fcb8..31d62e10 100644
--- a/src/fe-common/core/completion.c
+++ b/src/fe-common/core/completion.c
@@ -284,9 +284,9 @@ GList *filename_complete(const char *path, const char *default_path)
GList *list;
DIR *dirp;
struct dirent *dp;
- const char *basename;
+ char *basename;
char *realpath, *dir, *name;
- int len;
+ size_t len;
g_return_val_if_fail(path != NULL, NULL);
@@ -319,7 +319,7 @@ GList *filename_complete(const char *path, const char *default_path)
g_free_and_null(dir);
}
- basename = g_basename(path);
+ basename = g_path_get_basename(path);
len = strlen(basename);
/* add all files in directory to completion list */
@@ -341,6 +341,7 @@ GList *filename_complete(const char *path, const char *default_path)
}
}
closedir(dirp);
+ g_free(basename);
g_free_not_null(dir);
return list;
diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c
index a3a23c2d..548836ac 100644
--- a/src/fe-common/core/themes.c
+++ b/src/fe-common/core/themes.c
@@ -1138,6 +1138,7 @@ static void theme_save(THEME_REC *theme, int save_all)
CONFIG_REC *config;
THEME_SAVE_REC data;
char *path;
+ char *basename;
int ok;
config = config_open(theme->path, -1);
@@ -1160,10 +1161,11 @@ static void theme_save(THEME_REC *theme, int save_all)
data.save_all = save_all;
g_hash_table_foreach(theme->modules, (GHFunc) module_save, &data);
+ basename = g_path_get_basename(theme->path);
/* always save the theme to ~/.irssi/ */
- path = g_strdup_printf("%s/%s", get_irssi_dir(),
- g_basename(theme->path));
+ path = g_strdup_printf("%s/%s", get_irssi_dir(), basename);
ok = config_write(config, path, 0660) == 0;
+ g_free(basename);
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
ok ? TXT_THEME_SAVED : TXT_THEME_SAVE_FAILED,