aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cbuild_impl.c3
-rwxr-xr-xtest_project/build.c4
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(&reg, 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;
}