summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--functions.h1
-rw-r--r--openttd.c16
-rw-r--r--string.c18
-rw-r--r--string.h2
4 files changed, 20 insertions, 17 deletions
diff --git a/functions.h b/functions.h
index f974b6af0..5ee31e782 100644
--- a/functions.h
+++ b/functions.h
@@ -275,7 +275,6 @@ void CheckConfig(void);
int ttd_main(int argc, char* argv[]);
void DeterminePaths(void);
-char * CDECL str_fmt(const char *str, ...);
void bubblesort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
bool CreateOTTDThread(void *func, void *param);
diff --git a/openttd.c b/openttd.c
index 6e9b5130a..15262f8e4 100644
--- a/openttd.c
+++ b/openttd.c
@@ -93,22 +93,6 @@ void CDECL ShowInfoF(const char *str, ...)
ShowInfo(buf);
}
-char * CDECL str_fmt(const char *str, ...)
-{
- char buf[4096];
- va_list va;
- int len;
- char *p;
-
- va_start(va, str);
- len = vsprintf(buf, str, va);
- va_end(va);
- p = malloc(len + 1);
- if (p)
- memcpy(p, buf, len + 1);
- return p;
-}
-
void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize)
{
diff --git a/string.c b/string.c
index fd592eaaa..ee5f1152e 100644
--- a/string.c
+++ b/string.c
@@ -3,6 +3,8 @@
#include "stdafx.h"
#include "string.h"
+#include <stdarg.h>
+
void ttd_strlcat(char *dst, const char *src, size_t size)
{
assert(size > 0);
@@ -39,3 +41,19 @@ char* strecpy(char* dst, const char* src, const char* last)
*dst = '\0';
return dst;
}
+
+
+char* CDECL str_fmt(const char* str, ...)
+{
+ char buf[4096];
+ va_list va;
+ int len;
+ char* p;
+
+ va_start(va, str);
+ len = vsprintf(buf, str, va);
+ va_end(va);
+ p = malloc(len + 1);
+ if (p != NULL) memcpy(p, buf, len + 1);
+ return p;
+}
diff --git a/string.h b/string.h
index c20746517..a3f8264d7 100644
--- a/string.h
+++ b/string.h
@@ -23,4 +23,6 @@ void ttd_strlcpy(char *dst, const char *src, size_t size);
char* strecat(char* dst, const char* src, const char* last);
char* strecpy(char* dst, const char* src, const char* last);
+char* CDECL str_fmt(const char* str, ...);
+
#endif