diff options
author | Slendi <slendi@socopon.com> | 2024-01-14 15:15:03 +0200 |
---|---|---|
committer | Slendi <slendi@socopon.com> | 2024-01-14 15:15:03 +0200 |
commit | 8a2edb4d72c6c20cc3fa3c2c1fba23f653cbd7b6 (patch) | |
tree | 7d3eba8029e5e2fad7d877e601ed8e0da9f8d37d | |
parent | 5b1f02799f851f630d56f4d70b455bbc15eb6b36 (diff) |
Fix directory file findingmaster
Signed-off-by: Slendi <slendi@socopon.com>
-rw-r--r-- | cbuild_impl.c | 3 | ||||
-rwxr-xr-x | test_project/build.c | 4 |
2 files changed, 3 insertions, 4 deletions
diff --git a/cbuild_impl.c b/cbuild_impl.c index cefd00b..efe47eb 100644 --- a/cbuild_impl.c +++ b/cbuild_impl.c @@ -320,7 +320,6 @@ bool find_sources_in_directory(char *pattern, char *directory, char **sources) { } while ((entry = readdir(d))) { if (!regexec(®, entry->d_name, 0, NULL, 0)) { - printf("found: %s\n", entry->d_name); size_t len = strlen(entry->d_name); size_t new_size = sources_buffer_size + len + 2 + strlen_directory + 1; @@ -338,7 +337,7 @@ bool find_sources_in_directory(char *pattern, char *directory, char **sources) { strcpy(sources_buffer + sources_buffer_size + strlen_directory + 1, entry->d_name); - sources_buffer_size = new_size; + sources_buffer_size += new_size - 1; } } closedir(d); diff --git a/test_project/build.c b/test_project/build.c index a2ff2be..eee223e 100755 --- a/test_project/build.c +++ b/test_project/build.c @@ -19,8 +19,7 @@ int main(int argc, char **argv) { offset += strlen(sources + offset) + 1) { fprintf(stderr, " - %s\n", sources + offset); } - executable_t exe = - create_executable("hello", "src/coompiler.c\0src/main.c\0\0"); + executable_t exe = create_executable("hello", sources); add_target(&proj, &exe); if (argc > 1) { if (strcmp(argv[1], "clean") == 0) { @@ -29,5 +28,6 @@ int main(int argc, char **argv) { } } build(proj); + free(sources); return 0; } |