replace non-thread-safe functions

replace all uses of strtok, localtime, gmtime and readdir

on platforms without safe versions, use homebrew or unsafe...
This commit is contained in:
ac-stef
2016-02-28 23:14:47 +01:00
parent 98d01d1f34
commit 32ffd3a4cd
11 changed files with 60 additions and 38 deletions
+4 -4
View File
@@ -256,11 +256,11 @@ void toserverme(char *text)
void echo(char *text)
{
const char *s = strtok(text, "\n");
char *b, *s = strtok_r(text, "\n", &b);
do
{
conoutf("%s", s ? s : "");
s = strtok(NULL, "\n");
s = strtok_r(NULL, "\n", &b);
}
while(s);
}
@@ -268,12 +268,12 @@ void echo(char *text)
VARP(allowhudechos, 0, 1, 1);
void hudecho(char *text)
{
const char *s = strtok(text, "\n");
char *b, *s = strtok_r(text, "\n", &b);
void (*outf)(const char *s, ...) = allowhudechos ? hudoutf : conoutf;
do
{
outf("%s", s ? s : "");
s = strtok(NULL, "\n");
s = strtok_r(NULL, "\n", &b);
}
while(s);
}