From 07bc199e35072d8cb65ad4e9b3d78a968589fe0b Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 26 Jun 2014 19:33:49 +0200 Subject: [PATCH] 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). --- player/scripting.c | 5 +++-- 1 file 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]); }