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
fix the constness of xbt_strbuff_new_from(), it's too dangerous with previous prototype
[simgrid.git]
/
src
/
xbt
/
xbt_strbuff.c
diff --git
a/src/xbt/xbt_strbuff.c
b/src/xbt/xbt_strbuff.c
index
16835fd
..
1db4432
100644
(file)
--- a/
src/xbt/xbt_strbuff.c
+++ b/
src/xbt/xbt_strbuff.c
@@
-40,12
+40,12
@@
xbt_strbuff_t xbt_strbuff_new(void)
/** @brief creates a new string buffer containing the provided string
*
/** @brief creates a new string buffer containing the provided string
*
- * Beware,
we store the ctn directly, not a copy of it
+ * Beware,
the ctn is copied, you want to free it afterward, anyhow
*/
*/
-XBT_INLINE xbt_strbuff_t xbt_strbuff_new_from(char *ctn)
+XBT_INLINE xbt_strbuff_t xbt_strbuff_new_from(c
onst c
har *ctn)
{
xbt_strbuff_t res = malloc(sizeof(s_xbt_strbuff_t));
{
xbt_strbuff_t res = malloc(sizeof(s_xbt_strbuff_t));
- res->data =
ctn
;
+ res->data =
xbt_strdup(ctn)
;
res->used = res->size = strlen(ctn);
return res;
}
res->used = res->size = strlen(ctn);
return res;
}