From 04c02796bd371e65f81a92b853658b8fbadb7ad5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 9 May 2015 15:26:47 +0200 Subject: path: make mp_path_join accept normal C strings Instead of bstr. Most callers of this function do not need bstr. The bstr version of this function is now mp_path_join_bstr(). --- player/configfiles.c | 4 ++-- player/lua.c | 4 ++-- player/screenshot.c | 2 +- player/scripting.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'player') diff --git a/player/configfiles.c b/player/configfiles.c index 52cd837ab7..984a0fd02e 100644 --- a/player/configfiles.c +++ b/player/configfiles.c @@ -117,7 +117,7 @@ static void mp_load_per_file_config(struct MPContext *mpctx) char *name = mp_basename(cfg); bstr dir = mp_dirname(cfg); - char *dircfg = mp_path_join(NULL, dir, bstr0("mpv.conf")); + char *dircfg = mp_path_join_bstr(NULL, dir, bstr0("mpv.conf")); try_load_config(mpctx, dircfg, FILE_LOCAL_FLAGS); talloc_free(dircfg); @@ -181,7 +181,7 @@ static char *mp_get_playback_resume_config_filename(struct mpv_global *global, char *cwd = mp_getcwd(tmp); if (!cwd) goto exit; - realpath = mp_path_join(tmp, bstr0(cwd), bstr0(fname)); + realpath = mp_path_join(tmp, cwd, fname); } } if (bstr_startswith0(bfname, "dvd://")) diff --git a/player/lua.c b/player/lua.c index 8cfcd059a4..2e00f79dda 100644 --- a/player/lua.c +++ b/player/lua.c @@ -280,7 +280,7 @@ static void set_path(lua_State *L) char **luadir = mp_find_all_config_files(tmp, get_mpctx(L)->global, "scripts"); for (int i = 0; luadir && luadir[i]; i++) { newpath = talloc_asprintf_append(newpath, ";%s", - mp_path_join(tmp, bstr0(luadir[i]), bstr0("?.lua"))); + mp_path_join(tmp, luadir[i], "?.lua")); } lua_pushstring(L, newpath); // package path newpath @@ -1142,7 +1142,7 @@ static int script_join_path(lua_State *L) { const char *p1 = luaL_checkstring(L, 1); const char *p2 = luaL_checkstring(L, 2); - char *r = mp_path_join(NULL, bstr0(p1), bstr0(p2)); + char *r = mp_path_join(NULL, p1, p2); lua_pushstring(L, r); talloc_free(r); return 1; diff --git a/player/screenshot.c b/player/screenshot.c index 0449dfb5a1..f30ccf9581 100644 --- a/player/screenshot.c +++ b/player/screenshot.c @@ -284,7 +284,7 @@ static char *gen_fname(screenshot_ctx *ctx, const char *file_ext) if (dir && dir[0]) { void *t = fname; dir = mp_get_user_path(t, ctx->mpctx->global, dir); - fname = mp_path_join(NULL, bstr0(dir), bstr0(fname)); + fname = mp_path_join(NULL, dir, fname); talloc_free(t); mp_mkdirp(dir); diff --git a/player/scripting.c b/player/scripting.c index eafe568c56..3ae97193ba 100644 --- a/player/scripting.c +++ b/player/scripting.c @@ -163,7 +163,7 @@ static char **list_script_files(void *talloc_ctx, char *path) return NULL; struct dirent *ep; while ((ep = readdir(dp))) { - char *fname = mp_path_join(talloc_ctx, bstr0(path), bstr0(ep->d_name)); + char *fname = mp_path_join(talloc_ctx, path, ep->d_name); struct stat s; if (!stat(fname, &s) && S_ISREG(s.st_mode)) MP_TARRAY_APPEND(talloc_ctx, files, count, fname); -- cgit v1.2.3