From: Amadeusz Sławiński Date: Wed, 22 Feb 2017 12:54:25 +0000 (+0100) Subject: cleanups in unquote function X-Git-Tag: xonotic-v0.8.5~2843^2~13 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=af01f8784f2c07ff46e2c8055e77f8d163c78952;p=xonotic%2Fxonotic-data.pk3dir.git cleanups in unquote function reduce scope of variables, use && instead of double if, and use already set variable instead of calculatin anew --- diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 92ed2b9f1..752a99f1f 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -231,16 +231,13 @@ string MapInfo_BSPName_ByID(float i) string unquote(string s) { - float i, j, l; - l = strlen(s); - j = -1; - for(i = 0; i < l; ++i) + float l = strlen(s); + for(float i = 0; i < l; ++i) { - string ch; - ch = substring(s, i, 1); - if(ch != " ") if(ch != "\"") + string ch = substring(s, i, 1); + if((ch != " ") && (ch != "\"")) { - for(j = strlen(s) - i - 1; j > 0; --j) + for(float j = l - i - 1; j > 0; --j) { ch = substring(s, i+j, 1); if(ch != " ") if(ch != "\"")