Use the same-type variable in a loop, as in loop condition

This fixes (most of the) warnings like this:
darktable/src/common/cache.c:382:17: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
  for(int k=0; k<=cache->segment_mask; k++)
               ~^ ~~~~~~~~~~~~~~~~~~~
Merge remote-tracking branch 'upstream/master' into correct-forvariable-type
Merge branch 'correct-forvariable-type' of git://github.com/LebedevRI/darktable
Merge remote-tracking branch 'origin/master' into lua
error in the initialisation logic

use the global variable, since the L parameter might be null but the global value has been set at this point
get rid of a stray debug printf
rework init, only one init file but we look for loadable script in configdir/lua