Cache full_path in FileSpec
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/648541a5 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/648541a5 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/648541a5 Branch: refs/heads/include_dir_fixes Commit: 648541a5f3ac10e461e10ab20de30e398da3bbd5 Parents: c25e329 Author: Nick Wellnhofer <[email protected]> Authored: Fri Aug 1 14:31:16 2014 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Fri Aug 1 14:36:03 2014 +0200 ---------------------------------------------------------------------- compiler/src/CFCFileSpec.c | 11 +++++++++++ compiler/src/CFCFileSpec.h | 3 +++ 2 files changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/648541a5/compiler/src/CFCFileSpec.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCFileSpec.c b/compiler/src/CFCFileSpec.c index 41e3ba4..90e3b76 100644 --- a/compiler/src/CFCFileSpec.c +++ b/compiler/src/CFCFileSpec.c @@ -14,6 +14,8 @@ * limitations under the License. */ +#include "charmony.h" + #include <string.h> #include <stdio.h> #include <ctype.h> @@ -33,6 +35,7 @@ struct CFCFileSpec { CFCBase base; char *source_dir; char *path_part; + char *path; int is_included; }; @@ -57,6 +60,8 @@ CFCFileSpec_init(CFCFileSpec *self, const char *source_dir, self->source_dir = CFCUtil_strdup(source_dir); self->path_part = CFCUtil_strdup(path_part); + self->path = CFCUtil_sprintf("%s" CHY_DIR_SEP "%s", source_dir, + path_part); self->is_included = !!is_included; return self; @@ -66,10 +71,16 @@ void CFCFileSpec_destroy(CFCFileSpec *self) { FREEMEM(self->source_dir); FREEMEM(self->path_part); + FREEMEM(self->path); CFCBase_destroy((CFCBase*)self); } const char* +CFCFileSpec_get_path(CFCFileSpec *self) { + return self->path; +} + +const char* CFCFileSpec_get_source_dir(CFCFileSpec *self) { return self->source_dir; } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/648541a5/compiler/src/CFCFileSpec.h ---------------------------------------------------------------------- diff --git a/compiler/src/CFCFileSpec.h b/compiler/src/CFCFileSpec.h index 830a618..971bdd5 100644 --- a/compiler/src/CFCFileSpec.h +++ b/compiler/src/CFCFileSpec.h @@ -53,6 +53,9 @@ void CFCFileSpec_destroy(CFCFileSpec *self); const char* +CFCFileSpec_get_path(CFCFileSpec *self); + +const char* CFCFileSpec_get_source_dir(CFCFileSpec *self); const char*
