From c4696fe512cbdc18efc9411261ae4353ee9328b9 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 7 May 2005 10:01:38 +0000 Subject: [PATCH] =?UTF-8?q?Parameter=20f=C3=BCr=20msg=5Fmessage()=20m?= =?UTF-8?q?=C3=BCssen=20nicht=20mit=20strdup=20kopiert=20werden,=20dass=20?= =?UTF-8?q?tut=20copy=5Farg()=20schon.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/kernel/battle.c | 6 +++--- src/common/modules/gmcmd.c | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index 033c0bc50..cb201a280 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -289,7 +289,7 @@ message_all(battle * b, message * m) void battlerecord(battle * b, const char *s) { - struct message * m = msg_message("msg_battle", "string", strdup(s)); + struct message * m = msg_message("msg_battle", "string", s); message_all(b, m); msg_release(m); } @@ -303,7 +303,7 @@ battlemsg(battle * b, unit * u, const char * s) watcher * w; sprintf(buf, "%s %s", unitname(u), s); - m = msg_message("msg_battle", "string", strdup(buf)); + m = msg_message("msg_battle", "string", buf); for (bf=b->factions;bf;bf=bf->next) { message_faction(b, bf->faction, m); } @@ -317,7 +317,7 @@ battlemsg(battle * b, unit * u, const char * s) static void fbattlerecord(battle * b, faction * f, const char *s) { - message * m = msg_message("msg_battle", "string", gc_add(strdup(s))); + message * m = msg_message("msg_battle", "string", s); message_faction(b, f, m); msg_release(m); } diff --git a/src/common/modules/gmcmd.c b/src/common/modules/gmcmd.c index e31382a9b..d49018961 100644 --- a/src/common/modules/gmcmd.c +++ b/src/common/modules/gmcmd.c @@ -276,7 +276,7 @@ gm_messageplane(const tnode * tnext, const char * str, void * data, struct order mistake(u, ord, "Unzureichende Rechte für diesen Befehl.\n", 0); } else { - message * msg = msg_message("msg_event", "string", strdup(zmsg)); + message * msg = msg_message("msg_event", "string", zmsg); faction * f; region * r; for (f=factions;f;f=f->next) { @@ -372,10 +372,9 @@ gm_killunit(const tnode * tnext, const char * str, void * data, struct order * o mistake(u, ord, "Unzureichende Rechte für diesen Befehl.\n", 0); } else { - char * zmsg = (char*)gc_add(strdup(msg)); scale_number(target, 0); ADDMSG(&target->faction->msgs, msg_message("killedbygm", - "region unit string", r, target, zmsg)); + "region unit string", r, target, msg)); } } } @@ -445,9 +444,8 @@ gm_messageunit(const tnode * tnext, const char * str, void * data, struct order mistake(u, ord, "Unzureichende Rechte für diesen Befehl.\n", 0); } else { - char * m = (char*)gc_add(strdup(msg)); add_message(&target->faction->msgs, - msg_message("unitmessage", "region unit string", r, u, m)); + msg_message("unitmessage", "region unit string", r, u, msg)); } } }