summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-26 20:04:12 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-26 20:04:12 +0000
commit8eb983dd647fb7d2082b06626f85af1d119bf9d4 (patch)
tree6a12109d4aeb37174a33d61c8a9887707dcf9392
parentdc3c2ec158d8bc235773d07fd8ff420baad1c23f (diff)
Strlen tidyup (based on results of gprof output)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1201 e03df62e-2008-0410-955e-edbf42e46eb7
-rwxr-xr-xconfigure6
-rw-r--r--src/inspircd.cpp17
-rw-r--r--src/inspircd_io.cpp3
3 files changed, 13 insertions, 13 deletions
diff --git a/configure b/configure
index ec8ad7f29..b36e30b9c 100755
--- a/configure
+++ b/configure
@@ -424,9 +424,9 @@ EOF
{
$flags = getcompilerflags("src/modules/m_".$i.".cpp");
print FILEHANDLE <<EOCHEESE;
-$i.so: $i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/servers.h ../../include/base.h
- \$(CC) -I../../include \$(FLAGS) -shared $flags -o $i.so $i.cpp
- \@cp $i.so \$(MODPATH)/
+m_$i.so: m_$i.cpp ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/servers.h ../../include/base.h
+ \$(CC) -I../../include \$(FLAGS) -shared $flags -o m_$i.so m_$i.cpp
+ \@cp m_$i.so \$(MODPATH)/
EOCHEESE
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index d04051364..0e36bc674 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -559,11 +559,11 @@ void Write(int sock,char *text, ...)
va_start (argsPtr, text);
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
- snprintf(tb,MAXBUF,"%s\r\n",textbuffer);
+ int bytes = snprintf(tb,MAXBUF,"%s\r\n",textbuffer);
chop(tb);
if (sock != -1)
{
- write(sock,tb,strlen(tb));
+ write(sock,tb,bytes > 514 ? 514 : bytes);
}
}
@@ -584,11 +584,11 @@ void WriteServ(int sock, char* text, ...)
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
- snprintf(tb,MAXBUF,":%s %s\r\n",ServerName,textbuffer);
+ int bytes = snprintf(tb,MAXBUF,":%s %s\r\n",ServerName,textbuffer);
chop(tb);
if (sock != -1)
{
- write(sock,tb,strlen(tb));
+ write(sock,tb,bytes > 514 ? 514 : bytes);
}
}
@@ -609,11 +609,11 @@ void WriteFrom(int sock, userrec *user,char* text, ...)
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
- snprintf(tb,MAXBUF,":%s!%s@%s %s\r\n",user->nick,user->ident,user->dhost,textbuffer);
+ int bytes = snprintf(tb,MAXBUF,":%s!%s@%s %s\r\n",user->nick,user->ident,user->dhost,textbuffer);
chop(tb);
if (sock != -1)
{
- write(sock,tb,strlen(tb));
+ write(sock,tb,bytes > 514 ? 514 : bytes);
}
}
@@ -1144,6 +1144,7 @@ void WriteMode(const char* modes, int flags, const char* text, ...)
va_start (argsPtr, text);
vsnprintf(textbuffer, MAXBUF, text, argsPtr);
va_end(argsPtr);
+ int modelen = strlen(modes);
for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++)
{
@@ -1154,7 +1155,7 @@ void WriteMode(const char* modes, int flags, const char* text, ...)
if (flags == WM_AND)
{
send_to_user = true;
- for (int n = 0; n < strlen(modes); n++)
+ for (int n = 0; n < modelen; n++)
{
if (!hasumode(i->second,modes[n]))
{
@@ -1166,7 +1167,7 @@ void WriteMode(const char* modes, int flags, const char* text, ...)
else if (flags == WM_OR)
{
send_to_user = false;
- for (int n = 0; n < strlen(modes); n++)
+ for (int n = 0; n < modelen; n++)
{
if (hasumode(i->second,modes[n]))
{
diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp
index 03596b4bc..72d4ee056 100644
--- a/src/inspircd_io.cpp
+++ b/src/inspircd_io.cpp
@@ -110,11 +110,10 @@ int DaemonSeed (void)
setsid ();
umask (007);
printf("InspIRCd PID: %d\n",getpid());
- /* close stdin, stdout, stderr */
freopen("/dev/null","w",stdout);
freopen("/dev/null","w",stderr);
- setpriority(PRIO_PROCESS,(int)getpid(),15); /* ircd sets to low process priority so it doesnt hog the box */
+ setpriority(PRIO_PROCESS,(int)getpid(),15);
if (unlimitcore)
{