From af01f8784f2c07ff46e2c8055e77f8d163c78952 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Amadeusz=20S=C5=82awi=C5=84ski?= Date: Wed, 22 Feb 2017 13:54:25 +0100 Subject: [PATCH] cleanups in unquote function reduce scope of variables, use && instead of double if, and use already set variable instead of calculatin anew --- qcsrc/common/mapinfo.qc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) 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 != "\"") -- 2.39.2