From 85653f04d4eae3483b7c170cf844986637eec825 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Sun, 24 Apr 2016 18:05:15 +0200 Subject: [PATCH] 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()). --- src/Airports/apt_loader.cxx | 6 ------ 1 file changed, 6 deletions(-) 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") -- 2.39.5