X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcsourcefile.cpp;h=e34ff279cc4c98d199b491c075e17bc4c689a449;hb=2d765e850b2360940111cbd522af659cc3c4aef7;hp=13c74b9dcef247402490da7d7638de379c50f067;hpb=b1c51196b34f644e821f351c2acdb48619aed2e3;p=builder.git diff --git a/source/csourcefile.cpp b/source/csourcefile.cpp index 13c74b9..e34ff27 100644 --- a/source/csourcefile.cpp +++ b/source/csourcefile.cpp @@ -22,6 +22,16 @@ CSourceFile::CSourceFile(Builder &b, const Component &c, const FS::Path &p): install_location = FS::Path("include")/package->get_name(); } +void CSourceFile::parse_includes(IO::Base &in) +{ + static Regex r_include("^[ \t]*#include[ \t]+([\"<].*)[\">]"); + + string line; + while(in.getline(line)) + if(RegMatch match = r_include.match(line)) + includes.push_back(match[1].str); +} + void CSourceFile::find_dependencies() { if(!component || !mtime) @@ -38,13 +48,7 @@ void CSourceFile::find_dependencies() builder.get_logger().log("files", format("Reading includes from %s", path.str())); - Regex r_include("^[ \t]*#include[ \t]+([\"<].*)[\">]"); - - string line; - while(in.getline(line)) - if(RegMatch match = r_include.match(line)) - includes.push_back(match[1].str); - + parse_includes(in); cache.set_values(this, "includes", includes); }