#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.
static char spaces[128];
xbt_assert(length < 128);
- memset(spaces, ' ', length);
+ if (length != 0) {
+ memset(spaces, ' ', length);
+ }
spaces[length] = '\0';
return spaces;
}
*
* 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
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);