diff options
author | David Hill <dhill@conformal.com> | 2014-06-16 11:45:26 -0400 |
---|---|---|
committer | David Hill <dhill@conformal.com> | 2014-06-22 20:39:35 -0400 |
commit | 9d6cd87b0f548aba2094504c6ef71aec69f9d7fb (patch) | |
tree | 1397cb67399b24c9d0213de5d2074bb6ebeab306 /src | |
parent | c26a634fe6f65f44cdd036d2657fe4335ed6e309 (diff) | |
download | irssi-9d6cd87b0f548aba2094504c6ef71aec69f9d7fb.zip |
Replace deprecated g_basename with g_path_get_basename.
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/completion.c | 7 | ||||
-rw-r--r-- | src/fe-common/core/themes.c | 6 | ||||
-rw-r--r-- | src/irc/dcc/dcc-get.c | 5 | ||||
-rw-r--r-- | src/irc/dcc/dcc-send.c | 11 | ||||
-rw-r--r-- | src/perl/perl-core.c | 2 |
5 files changed, 16 insertions, 15 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, diff --git a/src/irc/dcc/dcc-get.c b/src/irc/dcc/dcc-get.c index 3c88ff24..8eee81b3 100644 --- a/src/irc/dcc/dcc-get.c +++ b/src/irc/dcc/dcc-get.c @@ -55,10 +55,13 @@ static void sig_dcc_destroyed(GET_DCC_REC *dcc) char *dcc_get_download_path(const char *fname) { char *str, *downpath; + char *base; + base = g_path_get_basename(fname); downpath = convert_home(settings_get_str("dcc_download_path")); - str = g_strconcat(downpath, G_DIR_SEPARATOR_S, g_basename(fname), NULL); + str = g_strconcat(downpath, G_DIR_SEPARATOR_S, base, NULL); g_free(downpath); + g_free(base); return str; } diff --git a/src/irc/dcc/dcc-send.c b/src/irc/dcc/dcc-send.c index 930ef770..558fd109 100644 --- a/src/irc/dcc/dcc-send.c +++ b/src/irc/dcc/dcc-send.c @@ -408,19 +408,14 @@ static int dcc_send_one_file(int queue, const char *target, const char *fname, handle = NULL; } - fname = g_basename(fname); + str = g_path_get_basename(fname); /* Replace all the spaces with underscore so that lesser intelligent clients can communicate.. */ - if (!settings_get_bool("dcc_send_replace_space_with_underscore")) - str = NULL; - else { - str = g_strdup(fname); + if (settings_get_bool("dcc_send_replace_space_with_underscore")) g_strdelimit(str, " ", '_'); - fname = str; - } - dcc = dcc_send_create(server, chat, target, fname); + dcc = dcc_send_create(server, chat, target, str); g_free(str); dcc->handle = handle; diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c index 08d0738c..c487c393 100644 --- a/src/perl/perl-core.c +++ b/src/perl/perl-core.c @@ -190,7 +190,7 @@ static char *script_file_get_name(const char *path) { char *name; - name = g_strdup(g_basename(path)); + name = g_path_get_basename(path); script_fix_name(name); return name; } |