X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4610b103f5b664648c716031782165da1e6fbd41..d8d4e03ef0522097adb78ee606e5f9cc489c0d29:/src/bindings/lua/lua_utils.c diff --git a/src/bindings/lua/lua_utils.c b/src/bindings/lua/lua_utils.c index 55721bc7c4..3f1f523f0a 100644 --- a/src/bindings/lua/lua_utils.c +++ b/src/bindings/lua/lua_utils.c @@ -10,7 +10,7 @@ #include "xbt.h" #include "xbt/log.h" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua_utils, lua, "Lua helper functions"); +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(lua_utils, bindings, "Lua helper functions"); /** * @brief Returns a string representation of a value in the Lua stack. @@ -103,7 +103,9 @@ const char* sglua_get_spaces(int length) { static char spaces[128]; xbt_assert(length < 128); - memset(spaces, ' ', length); + if (length != 0) { + memset(spaces, ' ', length); + } spaces[length] = '\0'; return spaces; } @@ -140,7 +142,6 @@ void sglua_stack_dump(const char* msg, lua_State* L) * * This function is a valid lua_Writer that writes into a memory buffer passed * as userdata. - * TODO: use a dynar as userdata * * @param L a lua state * @param source some data @@ -150,7 +151,7 @@ void sglua_stack_dump(const char* msg, lua_State* L) int sglua_memory_writer(lua_State* L, const void* source, size_t size, void* userdata) { - buffer_t buffer = (buffer_t) userdata; + sglua_buffer_t buffer = (sglua_buffer_t) userdata; while (buffer->capacity < buffer->size + size) { buffer->capacity *= 2; buffer->data = xbt_realloc(buffer->data, buffer->capacity);