From 396e0f6bd770e275142fd4d04df2dbda6c6d9c7c Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 1 Jan 2018 01:17:16 +0100 Subject: [PATCH] remove bsdstring from battle. --- src/battle.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/battle.c b/src/battle.c index da84b2763..fa4038b14 100644 --- a/src/battle.c +++ b/src/battle.c @@ -64,7 +64,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include -#include #include #include #include @@ -3517,10 +3516,10 @@ static int battle_report(battle * b) for (bf = b->factions; bf; bf = bf->next) { faction *fac = bf->faction; char buf[32 * MAXSIDES]; - char *bufp = buf; - size_t size = sizeof(buf) - 1; message *m; + sbstring sbs; + sbs_init(&sbs, buf, sizeof(buf)); battle_message_faction(b, fac, msg_separator); if (cont) @@ -3540,24 +3539,22 @@ static int battle_report(battle * b) char buffer[32]; if (komma) { - bufp = STRLCPY(bufp, ", ", size); + sbs_strcat(&sbs, ", "); } snprintf(buffer, sizeof(buffer), "%s %2d(%s): ", loc_army, army_index(s), abbrev); - - bufp = STRLCPY(bufp, buffer, size); + sbs_strcat(&sbs, buffer); for (r = FIGHT_ROW; r != NUMROWS; ++r) { if (alive[r]) { if (l != FIGHT_ROW) { - bufp = STRLCPY(bufp, "+", size); + sbs_strcat(&sbs, "+"); } while (k--) { - bufp = STRLCPY(bufp, "0+", size); + sbs_strcat(&sbs, "0+"); } sprintf(buffer, "%d", alive[r]); - - bufp = STRLCPY(bufp, buffer, size); + sbs_strcat(&sbs, buffer); k = 0; l = r + 1; @@ -3569,7 +3566,6 @@ static int battle_report(battle * b) komma = true; } } - *bufp = 0; fbattlerecord(b, fac, buf); } return cont;