Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename the plugins from the command line, and document it
[simgrid.git] / src / bindings / lua / lua_debug.cpp
index c02d921..120e460 100644 (file)
@@ -1,10 +1,9 @@
-/* Copyright (c) 2010-2016. The SimGrid Team.
+/* Copyright (c) 2010-2018. The SimGrid Team.
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-
 /*
  * This file contains functions that aid users to debug their lua scripts; for instance,
  * tables can be easily output and values are represented in a human-readable way. (For instance,
  *
  */
  /* SimGrid Lua debug functions                                             */
-extern "C" {
 #include <lauxlib.h>
-}
-#include "lua_utils.h"
+#include "lua_utils.hpp"
 #include "xbt.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(lua_debug, "Lua bindings (helper functions)");
@@ -215,13 +212,12 @@ void* sglua_checkudata_debug(lua_State* L, int ud, const char* tname)
  * @param size     number of bytes of data
  * @param userdata the memory buffer to write
  */
-int sglua_memory_writer(lua_State* L, const void* source, size_t size,
-    void* userdata) {
-
-  sglua_buffer_t buffer = (sglua_buffer_t) userdata;
+int sglua_memory_writer(lua_State* L, const void* source, size_t size, void* userdata)
+{
+  sglua_buffer_t buffer = static_cast<sglua_buffer_t>(userdata);
   while (buffer->capacity < buffer->size + size) {
     buffer->capacity *= 2;
-    buffer->data = (char*)xbt_realloc(buffer->data, buffer->capacity);
+    buffer->data = static_cast<char*>(xbt_realloc(buffer->data, buffer->capacity));
   }
   memcpy(buffer->data + buffer->size, source, size);
   buffer->size += size;