diff options
author | tron <tron@openttd.org> | 2005-07-29 21:52:20 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-07-29 21:52:20 +0000 |
commit | 3a162799fda12c14a7c551f05a0515a3e9e7829b (patch) | |
tree | 816549a247008ddd1c215593f389850ff7aec406 | |
parent | 1736566e22687b7ed9cf6c641eefc6fccd5611d6 (diff) | |
download | openttd-3a162799fda12c14a7c551f05a0515a3e9e7829b.tar.xz |
(svn r2754) Move str_fmt into string.[ch]
-rw-r--r-- | functions.h | 1 | ||||
-rw-r--r-- | openttd.c | 16 | ||||
-rw-r--r-- | string.c | 18 | ||||
-rw-r--r-- | string.h | 2 |
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); @@ -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) { @@ -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; +} @@ -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 |