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
Concatenate nested namespaces (sonar).
[simgrid.git]
/
src
/
xbt
/
string.cpp
diff --git
a/src/xbt/string.cpp
b/src/xbt/string.cpp
index
1b11219
..
412b22e
100644
(file)
--- a/
src/xbt/string.cpp
+++ b/
src/xbt/string.cpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2015-202
1
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2015-202
2
. 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 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. */
@@
-10,8
+10,7
@@
#include <cstdarg>
#include <cstdio>
#include <cstdarg>
#include <cstdio>
-namespace simgrid {
-namespace xbt {
+namespace simgrid::xbt {
#if SIMGRID_HAVE_MC
#if SIMGRID_HAVE_MC
@@
-26,14
+25,13
@@
std::string string_vprintf(const char *fmt, va_list ap)
va_copy(ap2, ap);
int size = std::vsnprintf(nullptr, 0, fmt, ap2);
va_end(ap2);
va_copy(ap2, ap);
int size = std::vsnprintf(nullptr, 0, fmt, ap2);
va_end(ap2);
- if (size < 0)
- xbt_die("string_vprintf error");
+ xbt_assert(size >= 0, "string_vprintf error");
// Allocate the string and format:
std::string res;
res.resize(size);
// Allocate the string and format:
std::string res;
res.resize(size);
- if (size != 0
&& std::vsnprintf(&res[0], size + 1, fmt, ap) != size
)
- xbt_
die(
"string_vprintf error");
+ if (size != 0)
+ xbt_
assert(std::vsnprintf(&res[0], size + 1, fmt, ap) == size,
"string_vprintf error");
return res;
}
return res;
}
@@
-53,5
+51,4
@@
std::string string_printf(const char *fmt, ...)
return res;
}
return res;
}
-}
-}
+} // namespace simgrid::xbt