From b1e59bed9e4699dda66aec2145954c24132d5aff Mon Sep 17 00:00:00 2001 From: Tim Cava Date: Sun, 7 Jul 2013 09:28:11 +0000 Subject: [PATCH] Convert uses of new_malloc/strcpy in end_vote() to m_strdup. While I'm here, don't cast what new_malloc returns. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@259 13b04d17-f746-0410-82c6-800466cd88b0 --- dll/acro/acro.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dll/acro/acro.c b/dll/acro/acro.c index e4e997c..79b61de 100644 --- a/dll/acro/acro.c +++ b/dll/acro/acro.c @@ -385,7 +385,7 @@ srec *end_vote(vrec *voters, prec *players, srec *stmp) prec *tmp2 = NULL; srec *tmp3 = NULL, *last; if (!stmp && voters && players) - stmp = (srec *)new_malloc(sizeof(srec)); + stmp = new_malloc(sizeof(srec)); for (tmp = voters; tmp; tmp = tmp->next) { gotscore = 0; @@ -394,8 +394,7 @@ srec *end_vote(vrec *voters, prec *players, srec *stmp) tmp2 = tmp2->next; if (stmp && !stmp->nick) { - stmp->nick = (char *)new_malloc(strlen(tmp2->nick)+1); - strcpy(stmp->nick, tmp2->nick); + stmp->nick = m_strdup(tmp2->nick); stmp->score = 1; continue; } @@ -411,9 +410,8 @@ srec *end_vote(vrec *voters, prec *players, srec *stmp) } if (!gotscore) { - tmp3 = last->next = (srec *)new_malloc(sizeof(srec)); - tmp3->nick = (char *)new_malloc(strlen(tmp2->nick)+1); - strcpy(tmp3->nick, tmp2->nick); + tmp3 = last->next = new_malloc(sizeof(srec)); + tmp3->nick = m_strdup(tmp2->nick); tmp3->score = 1; } }