From: terencehill Date: Fri, 9 Mar 2018 23:45:38 +0000 (+0100) Subject: Shorten a variable name used in 70K+ checks (when macros are expanded), reducing... X-Git-Tag: xonotic-v0.8.5~2241 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4c3b1c450547725880ba09327f3751dd6470e326;p=xonotic%2Fxonotic-data.pk3dir.git Shorten a variable name used in 70K+ checks (when macros are expanded), reducing size of server.qc by 560KB+ --- diff --git a/qcsrc/lib/spawnfunc.qh b/qcsrc/lib/spawnfunc.qh index 45203611c..e14002a6d 100644 --- a/qcsrc/lib/spawnfunc.qh +++ b/qcsrc/lib/spawnfunc.qh @@ -19,13 +19,13 @@ noref bool require_spawnfunc_prefix; } #define _spawnfunc_checktypes(fld) \ - if (fieldname == #fld) \ - if (!entityfieldassignablefromeditor(i)) LOG_FATALF("Entity field '%s' cannot be whitelisted", fieldname); + if (s == #fld) \ + if (!entityfieldassignablefromeditor(i)) LOG_FATALF("Entity field '%s' cannot be whitelisted", s); #else #define _spawnfunc_checktypes(fld) #endif #define _spawnfunc_check(fld) \ - if (fieldname == #fld) continue; + if (s == #fld) continue; noref int __spawnfunc_expecting; noref entity __spawnfunc_expect; @@ -111,13 +111,13 @@ noref bool require_spawnfunc_prefix; if (!this.spawnfunc_checked) { \ for (int i = 0, n = numentityfields(); i < n; ++i) { \ string value = getentityfieldstring(i, this); \ - string fieldname = entityfieldname(i); \ + string s = entityfieldname(i); \ whitelist(_spawnfunc_checktypes) \ if (value == "") continue; \ - if (fieldname == "") continue; \ + if (s == "") continue; \ FIELDS_COMMON(_spawnfunc_check) \ whitelist(_spawnfunc_check) \ - LOG_WARNF(_("Entity field %s.%s (%s) is not whitelisted. If you believe this is an error, please file an issue."), #id, fieldname, value); \ + LOG_WARNF(_("Entity field %s.%s (%s) is not whitelisted. If you believe this is an error, please file an issue."), #id, s, value); \ } \ this.spawnfunc_checked = true; \ if (this) { \