X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/03aea6f18fe087d771b0f6e179164fc9a905fe97..a96faee879f2b7a556a2428a8b38b0c081217a24:/src/xbt/xbt_strbuff.c diff --git a/src/xbt/xbt_strbuff.c b/src/xbt/xbt_strbuff.c index b12ff3c299..a474b3a258 100644 --- a/src/xbt/xbt_strbuff.c +++ b/src/xbt/xbt_strbuff.c @@ -88,10 +88,9 @@ void xbt_strbuff_append(xbt_strbuff_t b, const char *toadd) XBT_INLINE void xbt_strbuff_chomp(xbt_strbuff_t b) { - while (b->data[b->used] == '\n') { + while (b->used && b->data[b->used - 1] == '\n') { + b->used--; b->data[b->used] = '\0'; - if (b->used) - b->used--; } }