Parameter für msg_message() müssen nicht mit strdup kopiert werden, dass tut copy_arg() schon.

This commit is contained in:
Enno Rehling 2005-05-07 10:01:38 +00:00
parent 8656d93555
commit c4696fe512
2 changed files with 6 additions and 8 deletions

View File

@ -289,7 +289,7 @@ message_all(battle * b, message * m)
void void
battlerecord(battle * b, const char *s) 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); message_all(b, m);
msg_release(m); msg_release(m);
} }
@ -303,7 +303,7 @@ battlemsg(battle * b, unit * u, const char * s)
watcher * w; watcher * w;
sprintf(buf, "%s %s", unitname(u), s); 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) { for (bf=b->factions;bf;bf=bf->next) {
message_faction(b, bf->faction, m); message_faction(b, bf->faction, m);
} }
@ -317,7 +317,7 @@ battlemsg(battle * b, unit * u, const char * s)
static void static void
fbattlerecord(battle * b, faction * f, const char *s) 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); message_faction(b, f, m);
msg_release(m); msg_release(m);
} }

View File

@ -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); mistake(u, ord, "Unzureichende Rechte für diesen Befehl.\n", 0);
} }
else { else {
message * msg = msg_message("msg_event", "string", strdup(zmsg)); message * msg = msg_message("msg_event", "string", zmsg);
faction * f; faction * f;
region * r; region * r;
for (f=factions;f;f=f->next) { 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); mistake(u, ord, "Unzureichende Rechte für diesen Befehl.\n", 0);
} }
else { else {
char * zmsg = (char*)gc_add(strdup(msg));
scale_number(target, 0); scale_number(target, 0);
ADDMSG(&target->faction->msgs, msg_message("killedbygm", 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); mistake(u, ord, "Unzureichende Rechte für diesen Befehl.\n", 0);
} }
else { else {
char * m = (char*)gc_add(strdup(msg));
add_message(&target->faction->msgs, add_message(&target->faction->msgs,
msg_message("unitmessage", "region unit string", r, u, m)); msg_message("unitmessage", "region unit string", r, u, msg));
} }
} }
} }