Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Lua: fix an indentation bug in debug logs (the stack crashed)
authorChristophe Thiéry <christopho128@gmail.com>
Thu, 31 May 2012 15:59:38 +0000 (17:59 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 31 May 2012 16:12:42 +0000 (18:12 +0200)
src/bindings/lua/lua_state_cloner.c
src/bindings/lua/lua_utils.c

index e33aebb..11e97f2 100644 (file)
@@ -234,7 +234,6 @@ void sglua_copy_value(lua_State* src, lua_State* dst) {
       break;
   }
 
-  indent -= 2;
   XBT_DEBUG("%sData copied", sglua_get_spaces(indent));
 
   sglua_stack_dump("src after copying a value (should be ... value): ", src);
index 24bd4ab..efd257a 100644 (file)
@@ -103,7 +103,8 @@ const char* sglua_get_spaces(int length) {
 
   static char spaces[128];
 
-  xbt_assert(length < 128);
+  xbt_assert(length >= 0 && length < 128,
+      "Invalid indentation length: %d", length);
   if (length != 0) {
     memset(spaces, ' ', length);
   }