From: Florent Rougon Date: Sun, 24 Apr 2016 16:05:15 +0000 (+0200) Subject: apt.dat parser: remove useless code X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=85653f04d4eae3483b7c170cf844986637eec825;p=flightgear.git apt.dat parser: remove useless code Remove useless code before parsing the "row code" (terminology from the apt.dat v1000 spec). The row code is parsed with atoi(), which will automatically stop at the first space found if it saw at least one digit, thus there is no need to replace it with '\0', AFAICS. One could replace the existing atoi() call with things that do better checking, but my tests showed that would be a bit slower, so I let it this way (tried with std::istringstream and strtol()). --- diff --git a/src/Airports/apt_loader.cxx b/src/Airports/apt_loader.cxx index d99e9355e..67b1a6ee3 100644 --- a/src/Airports/apt_loader.cxx +++ b/src/Airports/apt_loader.cxx @@ -118,12 +118,6 @@ public: cache->setRebuildPhaseProgress(NavDataCache::REBUILD_AIRPORTS, percent); } - if (line.size() >= 3) { - char *p = (char *)memchr(tmp, ' ', 3); - if ( p ) - *p = 0; - } - line_id = atoi(tmp); if ( tmp[0] == 'I' || tmp[0] == 'A' ) { // First line, indicates IBM ("I") or Macintosh ("A")