From 4ffd644a14fa40b758f8937b06844861009bfec1 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 22 Dec 2005 17:18:18 +0000 Subject: Optimized out strcpys that copy empty strings (craq++) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2637 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/cmd_who.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/cmd_who.cpp') diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp index 9c74b29eb..bc3c090dd 100644 --- a/src/cmd_who.cpp +++ b/src/cmd_who.cpp @@ -82,8 +82,8 @@ void cmd_who::Handle (char **parameters, int pcnt, userrec *user) if ((!common_channels(user,i->second)) && (isnick(i->second->nick))) { // Bug Fix #29 - strcpy(tmp, ""); - if (strcmp(i->second->awaymsg, "")) { + *tmp = 0; + if (*i->second->awaymsg) { strlcat(tmp, "G", 9); } else { strlcat(tmp, "H", 9); @@ -120,8 +120,8 @@ void cmd_who::Handle (char **parameters, int pcnt, userrec *user) if ((has_channel(i->second,Ptr)) && (isnick(i->second->nick))) { // Fix Bug #29 - Part 2.. - strcpy(tmp, ""); - if (strcmp(i->second->awaymsg, "")) { + *tmp = 0; + if (*i->second->awaymsg) { strlcat(tmp, "G", 9); } else { strlcat(tmp, "H", 9); @@ -151,8 +151,8 @@ void cmd_who::Handle (char **parameters, int pcnt, userrec *user) if (u) { // Bug Fix #29 -- Part 29.. - strcpy(tmp, ""); - if (strcmp(u->awaymsg, "")) { + *tmp = 0; + if (*u->awaymsg) { strlcat(tmp, "G" ,9); } else { strlcat(tmp, "H" ,9); @@ -173,8 +173,8 @@ void cmd_who::Handle (char **parameters, int pcnt, userrec *user) // If i were a rich man.. I wouldn't need to me making these bugfixes.. // But i'm a poor bastard with nothing better to do. userrec* oper = *i; - strcpy(tmp, ""); - if (strcmp(oper->awaymsg, "")) { + *tmp = 0; + if (*oper->awaymsg) { strlcat(tmp, "G" ,9); } else { strlcat(tmp, "H" ,9); -- cgit v1.3.1-10-gc9f91