@@ -2725,30 +2725,28 @@ static std::string dirPath(const std::string& path) {
27252725 const std::size_t firstSlash = path.find_last_of (" \\ /" );
27262726 if (firstSlash == std::string::npos) {
27272727 return " " ;
2728- } else {
2729- return path.substr (0 , firstSlash + (withTrailingSlash ? 1U : 0U ));
27302728 }
2729+ return path.substr (0 , firstSlash + (withTrailingSlash ? 1U : 0U ));
27312730}
27322731
27332732static std::string omitPathTrailingSlash (const std::string& path) {
27342733 if (endsWith (path, " /" )) {
27352734 return path.substr (0 , path.size () - 1U );
2736- } else {
2737- return path;
27382735 }
2736+ return path;
27392737}
27402738
27412739static std::string extractRelativePathFromAbsolute (const std::string& absoluteSimplifiedPath, const std::string& prefixSimplifiedAbsoluteDir = currentDirectory()) {
27422740 const std::string normalizedAbsolutePath = omitPathTrailingSlash (absoluteSimplifiedPath);
27432741 std::string currentPrefix = omitPathTrailingSlash (prefixSimplifiedAbsoluteDir);
2744- std::string leadingParenting = " " ;
2742+ std::string leadingParenting;
27452743 while (!startsWith_ (normalizedAbsolutePath, currentPrefix)) {
27462744 leadingParenting = " ../" + leadingParenting;
27472745 currentPrefix = dirPath<false >(currentPrefix);
27482746 }
27492747 const std::size_t size = currentPrefix.size ();
27502748 std::string relativeFromMeetingPath = normalizedAbsolutePath.substr (size, normalizedAbsolutePath.size () - size);
2751- if (startsWith_ (relativeFromMeetingPath. c_str () , " /" )) {
2749+ if (startsWith_ (relativeFromMeetingPath, " /" )) {
27522750 // omit the leading slash
27532751 relativeFromMeetingPath = relativeFromMeetingPath.substr (1 , relativeFromMeetingPath.size ());
27542752 }
@@ -3182,9 +3180,8 @@ static std::string getRelativeFileName(const std::string &baseFile, const std::s
31823180 const std::string absolutePath = expandBaseWithAbsolutePath ? simplifiedPath : toAbsolutePath (simplifiedPath);
31833181 const std::string absoluteBaseFile = expandBaseWithAbsolutePath ? baseFileNormalized : toAbsolutePath (baseFileNormalized);
31843182 return extractRelativePathFromAbsolute (absolutePath, dirPath<true >(absoluteBaseFile));
3185- } else {
3186- return simplifiedPath;
31873183 }
3184+ return simplifiedPath;
31883185}
31893186
31903187static std::string openHeaderRelative (std::ifstream &f, const std::string &sourcefile, const std::string &header)
@@ -3253,9 +3250,8 @@ static std::string findPathInMapBothRelativeAndAbsolute(const std::map<std::stri
32533250
32543251 if (filedata.find (alternativePath) != filedata.end ()) {
32553252 return alternativePath;
3256- } else {
3257- return " " ;
32583253 }
3254+ return " " ;
32593255}
32603256
32613257static std::string getFileIdPath (const std::map<std::string, simplecpp::TokenList *> &filedata, const std::string &sourcefile, const std::string &header, const simplecpp::DUI &dui, bool systemheader)
0 commit comments