A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[sonar] Replace some C-style arrays.
[simgrid.git]
/
src
/
xbt
/
xbt_str.cpp
diff --git
a/src/xbt/xbt_str.cpp
b/src/xbt/xbt_str.cpp
index
6106399
..
dfd3d6b
100644
(file)
--- a/
src/xbt/xbt_str.cpp
+++ b/
src/xbt/xbt_str.cpp
@@
-9,6
+9,7
@@
#include "xbt/misc.h"
#include "xbt/str.h" /* headers of these functions */
#include "xbt/string.hpp"
#include "xbt/misc.h"
#include "xbt/str.h" /* headers of these functions */
#include "xbt/string.hpp"
+#include <array>
/** @brief Splits a string into a dynar of strings
*
/** @brief Splits a string into a dynar of strings
*
@@
-28,18
+29,18
@@
xbt_dynar_t xbt_str_split(const char *s, const char *sep)
{
xbt_dynar_t res = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
const char *sep_dflt = " \t\n\r\x0B";
{
xbt_dynar_t res = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
const char *sep_dflt = " \t\n\r\x0B";
-
char is_sep[256] = { 1, 0 }
;
+
std::array<bool, 256> is_sep
;
/* check what are the separators */
/* check what are the separators */
-
memset(is_sep, 0, sizeof(is_sep)
);
+
is_sep.fill(false
);
if (not sep) {
while (*sep_dflt)
if (not sep) {
while (*sep_dflt)
- is_sep[(unsigned char)
*sep_dflt++] = 1
;
+ is_sep[(unsigned char)
*sep_dflt++] = true
;
} else {
while (*sep)
} else {
while (*sep)
- is_sep[(unsigned char)
*sep++] = 1
;
+ is_sep[(unsigned char)
*sep++] = true
;
}
}
- is_sep[0] =
1
; /* End of string is also separator */
+ is_sep[0] =
true
; /* End of string is also separator */
/* Do the job */
const char* p = s;
/* Do the job */
const char* p = s;