summaryrefslogtreecommitdiff
path: root/src/users.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-01-12 20:25:51 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-01-12 20:25:51 +0000
commit6c725e7a4f39d898024d85b3b93265d3172c5183 (patch)
tree041a5e0eeda2cefcbc3ddc5826ff0c5ba30331b3 /src/users.cpp
parent8aa7f73bd76d5faacbfef59b308de7314d926fbf (diff)
Replaced sprintf's with some char* voodoo
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2781 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 2266075cb..256b04780 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -80,6 +80,18 @@ userrec::~userrec()
{
}
+void userrec::MakeHost(char* nhost)
+{
+ /* This is much faster than snprintf */
+ char* t = nhost;
+ for(char* n = ident; n; n++)
+ *t++ = *n;
+ *t++ = '@';
+ for(char* n = host; n; n++)
+ *t++ = *n;
+ *t = 0;
+}
+
void userrec::CloseSocket()
{
shutdown(this->fd,2);
@@ -89,7 +101,16 @@ void userrec::CloseSocket()
char* userrec::GetFullHost()
{
static char result[MAXBUF];
- snprintf(result,MAXBUF,"%s!%s@%s",nick,ident,dhost);
+ char* t = result;
+ for(char* n = nick; n; n++)
+ *t++ = *n;
+ *t++ = '!';
+ for(char* n = ident; n; n++)
+ *t++ = *n;
+ *t++ = '@';
+ for(char* n = dhost; n; n++)
+ *t++ = *n;
+ *t = 0;
return result;
}
@@ -106,7 +127,16 @@ int userrec::ReadData(void* buffer, size_t size)
char* userrec::GetFullRealHost()
{
static char fresult[MAXBUF];
- snprintf(fresult,MAXBUF,"%s!%s@%s",nick,ident,host);
+ char* t = fresult;
+ for(char* n = nick; n; n++)
+ *t++ = *n;
+ *t++ = '!';
+ for(char* n = ident; n; n++)
+ *t++ = *n;
+ *t++ = '@';
+ for(char* n = host; n; n++)
+ *t++ = *n;
+ *t = 0;
return fresult;
}