Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
drop module strbuff. We don't need it anymore.
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 21 May 2017 00:04:54 +0000 (02:04 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 21 May 2017 00:05:02 +0000 (02:05 +0200)
Killing XBT (and reduce our maintainance burden) was a major
motivation in the switch to C++.

15 files changed:
ChangeLog
doc/doxygen/inside_tests.doc
doc/doxygen/module-xbt.doc
include/xbt.h
include/xbt/strbuff.h [deleted file]
src/surf/maxmin.cpp
src/xbt/log.c
src/xbt/xbt_log_layout_format.c
src/xbt/xbt_log_layout_simple.c
src/xbt/xbt_str.cpp
src/xbt/xbt_strbuff.c [deleted file]
tools/cmake/DefinePackages.cmake
tools/cmake/Distrib.cmake
tools/cmake/GCCFlags.cmake
tools/internal/spell_dict.txt

index c8464ee..6ca3d3e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,7 +31,8 @@ SimGrid (3.16) UNRELEASED
  XBT
   - Replay: New function xbt_replay_action_get():
     Retrieve the function previously associated to an event type.
  XBT
   - Replay: New function xbt_replay_action_get():
     Retrieve the function previously associated to an event type.
-  - Drop unused functions: xbt_str_varsubst(), xbt_strbuff_varsubst()
+  - DROPPED FUNCTION: xbt_str_varsubst()
+  - DROPPED MODULE: strbuff. We don't need it anymore.
 
  -- Release target: June 21 2017   -- Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
 
 
  -- Release target: June 21 2017   -- Da SimGrid team <simgrid-devel@lists.gforge.inria.fr>
 
index 337344a..c8195c2 100644 (file)
@@ -72,7 +72,6 @@ your changes should look like that:
 --- a/tools/cmake/UnitTesting.cmake
 +++ b/tools/cmake/UnitTesting.cmake
 @@ -11,6 +11,7 @@ set(FILES_CONTAINING_UNITTESTS
 --- a/tools/cmake/UnitTesting.cmake
 +++ b/tools/cmake/UnitTesting.cmake
 @@ -11,6 +11,7 @@ set(FILES_CONTAINING_UNITTESTS
-   src/xbt/xbt_strbuff.c
    src/xbt/xbt_sha.c
    src/xbt/config.c
 +  src/xbt/plouf.c
    src/xbt/xbt_sha.c
    src/xbt/config.c
 +  src/xbt/plouf.c
index 3f53b36..395f744 100644 (file)
@@ -18,7 +18,6 @@
       - \ref XBT_dict
       - \ref XBT_swag
       - \ref XBT_heap
       - \ref XBT_dict
       - \ref XBT_swag
       - \ref XBT_heap
-      - @ref xbt_strbuff
     - \ref XBT_misc
       - \ref XBT_graph
 
     - \ref XBT_misc
       - \ref XBT_graph
 
index c30e685..9d5510e 100644 (file)
@@ -19,7 +19,6 @@
 #include <xbt/log.h>
 
 #include <xbt/module.h>
 #include <xbt/log.h>
 
 #include <xbt/module.h>
-#include <xbt/strbuff.h>
 
 #include <xbt/dynar.h>
 #include <xbt/dict.h>
 
 #include <xbt/dynar.h>
 #include <xbt/dict.h>
diff --git a/include/xbt/strbuff.h b/include/xbt/strbuff.h
deleted file mode 100644 (file)
index 41bb52e..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* strbuff -- string buffers                                                */
-
-/* Copyright (c) 2007-2011, 2013-2014. 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. */
-
-#ifndef XBT_STRBUFF_H
-#define XBT_STRBUFF_H
-
-#include "xbt/sysdep.h"
-#include "xbt/function_types.h"
-#include "xbt/log.h"
-#include "xbt/str.h"
-#include "xbt/dict.h"
-
-SG_BEGIN_DECL()
-
-/** @defgroup xbt_strbuff String buffers 
- *  @ingroup XBT_adt
- * 
- *  This data container is very similar to the Java StringBuffer: 
- *  that's a string to which you can add content with a lesser performance 
- *  penalty than if you recreate a new string from scratch. Once done building 
- *  your string, you must retrieve the content and free its container.
- * 
- *  @{
- */
-
-/** @brief Buffer data container **/
-typedef struct xbt_strbuff {
-  char *data;
-  int used;
-  int size;
-} s_xbt_strbuff_t;
-typedef s_xbt_strbuff_t* xbt_strbuff_t;
-
-XBT_PUBLIC(void) xbt_strbuff_clear(xbt_strbuff_t b);
-XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new(void);
-XBT_PUBLIC(xbt_strbuff_t) xbt_strbuff_new_from(const char *s);
-XBT_PUBLIC(void) xbt_strbuff_free(xbt_strbuff_t b);
-XBT_PUBLIC(void) xbt_strbuff_free_container(xbt_strbuff_t b);
-XBT_PUBLIC(void) xbt_strbuff_append(xbt_strbuff_t b, const char *toadd);
-XBT_PUBLIC(void) xbt_strbuff_printf(xbt_strbuff_t b, const char *fmt, ...);
-XBT_PUBLIC(void) xbt_strbuff_chomp(xbt_strbuff_t b);
-XBT_PUBLIC(void) xbt_strbuff_trim(xbt_strbuff_t b);
-
-/** @} */
-SG_END_DECL()
-#endif
index 0ab8b4d..99fc2a1 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
-#include "xbt/strbuff.h"
 #include "xbt/mallocator.h"
 #include "maxmin_private.hpp"
 #include <stdlib.h>
 #include "xbt/mallocator.h"
 #include "maxmin_private.hpp"
 #include <stdlib.h>
index 86fd9c3..44af691 100644 (file)
@@ -102,7 +102,6 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(log);
   XBT_LOG_CONNECT(module);
   XBT_LOG_CONNECT(replay);
   XBT_LOG_CONNECT(log);
   XBT_LOG_CONNECT(module);
   XBT_LOG_CONNECT(replay);
-  XBT_LOG_CONNECT(strbuff);
   XBT_LOG_CONNECT(xbt_cfg);
   XBT_LOG_CONNECT(xbt_dict);
   XBT_LOG_CONNECT(xbt_dict_cursor);
   XBT_LOG_CONNECT(xbt_cfg);
   XBT_LOG_CONNECT(xbt_dict);
   XBT_LOG_CONNECT(xbt_dict_cursor);
index 78e5600..50a82e2 100644 (file)
@@ -7,7 +7,6 @@
 
 #include "src/internal_config.h"       /* execinfo when available */
 #include "xbt/sysdep.h"
 
 #include "src/internal_config.h"       /* execinfo when available */
 #include "xbt/sysdep.h"
-#include "xbt/strbuff.h"
 #include "src/xbt/log_private.h"
 #include "simgrid/simix.h"      /* SIMIX_host_self_get_name */
 #include "surf/surf.h"
 #include "src/xbt/log_private.h"
 #include "simgrid/simix.h"      /* SIMIX_host_self_get_name */
 #include "surf/surf.h"
index c709fca..6ec8eeb 100644 (file)
@@ -7,7 +7,6 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/sysdep.h"
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "xbt/sysdep.h"
-#include "xbt/strbuff.h"        /* For dynamic version when the static one fails */
 #include "src/xbt/log_private.h"
 
 #include "simgrid/simix.h"      /* SIMIX_host_self_get_name */
 #include "src/xbt/log_private.h"
 
 #include "simgrid/simix.h"      /* SIMIX_host_self_get_name */
index 68ee360..76ad09e 100644 (file)
@@ -11,7 +11,6 @@
 #include "xbt/misc.h"
 #include "xbt/sysdep.h"
 #include "xbt/str.h"            /* headers of these functions */
 #include "xbt/misc.h"
 #include "xbt/sysdep.h"
 #include "xbt/str.h"            /* headers of these functions */
-#include "xbt/strbuff.h"
 
 /**  @brief Strip whitespace (or other characters) from the end of a string.
  *
 
 /**  @brief Strip whitespace (or other characters) from the end of a string.
  *
diff --git a/src/xbt/xbt_strbuff.c b/src/xbt/xbt_strbuff.c
deleted file mode 100644 (file)
index e87d383..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/* strbuff -- string buffers                                                */
-
-/* Copyright (c) 2007-2015. 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. */
-
-#include "xbt/strbuff.h"
-#include <stdarg.h>
-
-#define minimal_increment 512
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(strbuff, xbt, "String buffers");
-
-/** @brief Remove any content from the buffer */
-inline void xbt_strbuff_clear(xbt_strbuff_t b)
-{
-  b->used = 0;
-  b->data[0] = '\0';
-}
-
-/** @brief Constructor */
-xbt_strbuff_t xbt_strbuff_new(void)
-{
-  xbt_strbuff_t res = xbt_malloc(sizeof(s_xbt_strbuff_t));
-  res->data = xbt_malloc(512);
-  res->size = 512;
-  xbt_strbuff_clear(res);
-  return res;
-}
-
-/** @brief creates a new string buffer containing the provided string
- *
- * Beware, the ctn is copied, you want to free it afterward, anyhow
- */
-inline xbt_strbuff_t xbt_strbuff_new_from(const char *ctn)
-{
-  xbt_strbuff_t res = xbt_malloc(sizeof(s_xbt_strbuff_t));
-  res->data = xbt_strdup(ctn);
-  res->size = strlen(ctn);
-  res->used = res->size;
-  return res;
-}
-
-/** @brief frees only the container without touching to the contained string */
-inline void xbt_strbuff_free_container(xbt_strbuff_t b)
-{
-  free(b);
-}
-
-/** @brief frees the buffer and its content */
-inline void xbt_strbuff_free(xbt_strbuff_t b)
-{
-  if (b) {
-    free(b->data);
-    free(b);
-  }
-}
-
-/** @brief Adds some content at the end of the buffer */
-void xbt_strbuff_append(xbt_strbuff_t b, const char *toadd)
-{
-  int addlen;
-  int needed_space;
-
-  xbt_assert(b, "Asked to append stuff to NULL buffer");
-
-  addlen = strlen(toadd);
-  needed_space = b->used + addlen + 1;
-
-  if (needed_space > b->size) {
-    b->size = MAX(minimal_increment + b->used, needed_space);
-    b->data = xbt_realloc(b->data, b->size);
-  }
-  strncpy(b->data + b->used, toadd, b->size-b->used);
-  b->used += addlen;
-}
-
-/** @brief format some content and push it at the end of the buffer */
-void xbt_strbuff_printf(xbt_strbuff_t b, const char *fmt, ...)
-{
-  va_list ap;
-  va_start(ap, fmt);
-  char *data = bvprintf(fmt, ap);
-  xbt_strbuff_append(b, data);
-  xbt_free(data);
-  va_end(ap);
-}
index e513d43..b99f08e 100644 (file)
@@ -288,7 +288,6 @@ set(XBT_SRC
   src/xbt/xbt_os_time.c
   src/xbt/xbt_replay.cpp
   src/xbt/xbt_str.cpp
   src/xbt/xbt_os_time.c
   src/xbt/xbt_replay.cpp
   src/xbt/xbt_str.cpp
-  src/xbt/xbt_strbuff.c
   src/xbt/xbt_virtu.c
   src/xbt_modinter.h
   )
   src/xbt/xbt_virtu.c
   src/xbt_modinter.h
   )
@@ -734,7 +733,6 @@ set(headers_to_install
   include/xbt/range.hpp
   include/xbt/replay.hpp
   include/xbt/str.h
   include/xbt/range.hpp
   include/xbt/replay.hpp
   include/xbt/str.h
-  include/xbt/strbuff.h
   include/xbt/swag.h
   include/xbt/synchro.h
   include/xbt/sysdep.h
   include/xbt/swag.h
   include/xbt/synchro.h
   include/xbt/sysdep.h
index d13a04d..6a53677 100644 (file)
@@ -318,7 +318,6 @@ add_custom_target(maintainer-clean
   COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
   COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
   COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
   COMMAND ${CMAKE_COMMAND} -E remove -f src/simgrid_units_main.c
   COMMAND ${CMAKE_COMMAND} -E remove -f src/swag_unit.c
   COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_str_unit.c
-  COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_strbuff_unit.c
   COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
   WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}")
 
   COMMAND ${CMAKE_COMMAND} -E remove -f src/xbt_synchro_unit.c
   WORKING_DIRECTORY "${CMAKE_HOME_DIRECTORY}")
 
index 410bcb7..6615daa 100644 (file)
@@ -124,7 +124,7 @@ if(enable_model-checking AND enable_compile_optimizations)
       src/xbt/xbt_log_layout_format.c src/xbt/xbt_log_layout_simple.c
       src/xbt/dict.cpp src/xbt/dict_elm.c src/xbt/dict_cursor.c
       src/xbt/dynar.cpp src/xbt/heap.c src/xbt/swag.c
       src/xbt/xbt_log_layout_format.c src/xbt/xbt_log_layout_simple.c
       src/xbt/dict.cpp src/xbt/dict_elm.c src/xbt/dict_cursor.c
       src/xbt/dynar.cpp src/xbt/heap.c src/xbt/swag.c
-      src/xbt/str.c src/xbt/strbuff.c src/xbt/snprintf.c
+      src/xbt/str.c src src/xbt/snprintf.c
       src/xbt/queue.c
       src/xbt/xbt_os_time.c src/xbt/xbt_os_thread.c
       src/xbt/backtrace_linux.c
       src/xbt/queue.c
       src/xbt/xbt_os_time.c src/xbt/xbt_os_thread.c
       src/xbt/backtrace_linux.c
index 4ba5bbb..48cc959 100644 (file)
@@ -91,7 +91,6 @@ smpi
 smx
 src
 std
 smx
 src
 std
-strbuff
 strerror
 strlen
 struct
 strerror
 strlen
 struct