(uprnf): A print function must not change its text argument!
This commit is contained in:
parent
b5ff7e3beb
commit
1bf1b5b303
1 changed files with 12 additions and 4 deletions
|
@ -73,12 +73,20 @@ pr(char *format, ...)
|
|||
pr_player(player, C_DATA, buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print UTF-8 text BUF to current player.
|
||||
*/
|
||||
void
|
||||
uprnf(char *buf /* buf is message text */)
|
||||
uprnf(char *buf)
|
||||
{
|
||||
if (!(player->flags & PF_UTF8))
|
||||
copy_utf8_to_ascii_no_funny(buf, buf);
|
||||
char *p;
|
||||
|
||||
if (!(player->flags & PF_UTF8)) {
|
||||
p = malloc(strlen(buf) + 1);
|
||||
copy_utf8_to_ascii_no_funny(p, buf);
|
||||
pr_player(player, C_DATA, p);
|
||||
free(p);
|
||||
} else
|
||||
pr_player(player, C_DATA, buf);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue