summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-06-26 19:33:49 +0200
committerwm4 <wm4@nowhere>2014-06-26 19:56:45 +0200
commit07bc199e35072d8cb65ad4e9b3d78a968589fe0b (patch)
treea90b08a88db271e5d1e5dbdc3e7996bdf00220dd
parent3e631b9cb851a1c29880beaded78f2bbfa694976 (diff)
downloadmpv-07bc199e35072d8cb65ad4e9b3d78a968589fe0b.tar.bz2
mpv-07bc199e35072d8cb65ad4e9b3d78a968589fe0b.tar.xz
scripting: shorten a line
Also allows it to deal with NULL return values, which currently is not needed, but may or may not be required at some point in the future (what if malloc fails).
-rw-r--r--player/scripting.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/player/scripting.c b/player/scripting.c
index 2272f3c2ee..6f6c40687f 100644
--- a/player/scripting.c
+++ b/player/scripting.c
@@ -170,8 +170,9 @@ void mp_load_scripts(struct MPContext *mpctx)
// Load all lua scripts
void *tmp = talloc_new(NULL);
- for (char **luadir = mp_find_all_config_files(tmp, mpctx->global, "lua"); *luadir; luadir++) {
- files = list_script_files(tmp, *luadir);
+ char **luadir = mp_find_all_config_files(tmp, mpctx->global, "lua");
+ for (int i = 0; luadir && luadir[i]; i++) {
+ files = list_script_files(tmp, luadir[i]);
for (int n = 0; files && files[n]; n++)
mp_load_script(mpctx, files[n]);
}