From: terencehill Date: Sun, 10 Feb 2019 18:38:57 +0000 (+0100) Subject: Concatenate log header strings in code X-Git-Tag: xonotic-v0.8.5~1604^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7bdede86f899ea03fbf67bc1a367dd20390e113c;p=xonotic%2Fxonotic-data.pk3dir.git Concatenate log header strings in code --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index e32c0e8f5..96b3caa75 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -801,7 +801,7 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new) // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS. void CSQC_Ent_Update(entity this, bool isnew) { - this.sourceLoc = __FILE__ ":" STR(__LINE__); + this.sourceLoc = __FILE__":"STR(__LINE__); int t = ReadByte(); // set up the "time" global for received entities to be correct for interpolation purposes diff --git a/qcsrc/lib/log.qh b/qcsrc/lib/log.qh index 4b4f7b6bd..94a58d0ca 100644 --- a/qcsrc/lib/log.qh +++ b/qcsrc/lib/log.qh @@ -43,12 +43,12 @@ string(string, string...) strcat1n = #115; // would be nice if __FUNC__ could be concatenated at compile time #if 0 // less work, bigger binary - #define __SOURCELOC__ (sprintf("^7%s^9" "(" "^9"__FILE__"^7" ":" "^9"STR(__LINE__)"^7" ")", __FUNC__)) + #define __SOURCELOC__ (sprintf("^7%s^9(^9"__FILE__"^7:^9"STR(__LINE__)"^7)", __FUNC__)) #else - #define __SOURCELOC__ (sprintf("^7%s^9" "(" "^9%s^7" ":" "^9%s^7" ")", __FUNC__, __FILE__, STR(__LINE__))) + #define __SOURCELOC__ (sprintf("^7%s^9(^9%s^7:^9%s^7)", __FUNC__, __FILE__, STR(__LINE__))) #endif -#define _LOG_HEADER(level) "^9[::" "^7"PROGNAME"^9" "::" level"^9" "] ", __SOURCELOC__ +#define _LOG_HEADER(level) "^9[::^7"PROGNAME"^9::"level"^9] ", __SOURCELOC__ #define _LOG(f, level, s) \ MACRO_BEGIN \ f(strcat1n(_LOG_HEADER(level), "\n^7", s, "\n")); \ diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index 2994ea164..a6c363b8f 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -53,7 +53,7 @@ STATIC_INIT(TempEntities_renumber) { FOREACH(TempEntities, true, it.m_id = 80 + ACCUMULATE NET_HANDLE(id, bool isnew) \ { \ this = __self; \ - this.sourceLoc = __FILE__ ":" STR(__LINE__); \ + this.sourceLoc = __FILE__":"STR(__LINE__); \ if (!this) isnew = true; \ } \ NET_GUARD(id); \ diff --git a/qcsrc/lib/spawnfunc.qh b/qcsrc/lib/spawnfunc.qh index 37bb11768..bf8eeb34b 100644 --- a/qcsrc/lib/spawnfunc.qh +++ b/qcsrc/lib/spawnfunc.qh @@ -264,7 +264,7 @@ noref bool __spawnfunc_first; assert(this); \ } \ if (!this.sourceLoc) { \ - this.sourceLoc = __FILE__ ":" STR(__LINE__); \ + this.sourceLoc = __FILE__":"STR(__LINE__); \ } \ if (!this.spawnfunc_checked) { \ _checkWhitelisted(this, #id); \