1
0
mirror of https://github.com/anope/anope.git synced 2026-06-25 03:56:40 +02:00

Optimize much of the database code and serialize code.

This commit is contained in:
Adam
2012-12-13 06:12:56 -05:00
parent 76ba147c22
commit c1077faa28
60 changed files with 1203 additions and 1057 deletions
+2 -3
View File
@@ -93,16 +93,15 @@ static ModuleReturn moduleCopyFile(const Anope::string &name, Anope::string &out
}
int want = s.st_size;
char *buffer = new char[s.st_size];
char buffer[1024];
while (want > 0 && !source.fail() && !target.fail())
{
source.read(buffer, want);
source.read(buffer, std::min(want, static_cast<int>(sizeof(buffer))));
int read_len = source.gcount();
target.write(buffer, read_len);
want -= read_len;
}
delete [] buffer;
source.close();
target.close();