aboutsummaryrefslogtreecommitdiffstats
path: root/src/build.c
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2014-04-25 01:37:10 +0200
committerTharre <tharre3@gmail.com>2014-04-25 02:31:01 +0200
commit93a6741801be08f363d6a63282c60a8674864565 (patch)
treed193a4e35f632ddbc88742ba7a30376b891d9790 /src/build.c
parentd46b48a448deb539aaf93acc4425972e10bf5061 (diff)
downloadredo-93a6741801be08f363d6a63282c60a8674864565.tar.gz
redo-93a6741801be08f363d6a63282c60a8674864565.tar.xz
redo-93a6741801be08f363d6a63282c60a8674864565.zip
Refactor file_exists() to fexists()
Diffstat (limited to 'src/build.c')
-rw-r--r--src/build.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/build.c b/src/build.c
index f3e8424..3bd0abd 100644
--- a/src/build.c
+++ b/src/build.c
@@ -29,8 +29,8 @@ int build_target(const char *target) {
/* get the do-file which we are going to execute */
char *do_file = get_do_file(target);
- if (do_file == NULL) {
- if (file_exists(target)) {
+ if (!do_file) {
+ if (fexists(target)) {
/* if our target file has no do file associated but exists,
then we treat it as a source */
/* TODO: write dependencies */
@@ -152,19 +152,19 @@ char *get_do_file(const char *target) {
assert(target);
/* target + ".do" */
char *temp = concat(2, target, do_file_ext);
- if (file_exists(temp))
+ if (fexists(temp))
return temp;
free(temp);
/* default + get_extension(target) + ".do" */
temp = concat(3, default_name, take_extension(target), do_file_ext);
- if (file_exists(temp))
+ if (fexists(temp))
return temp;
free(temp);
/* Redofile */
temp = safe_strdup("Redofile");
- if (file_exists(temp))
+ if (fexists(temp))
return temp;
free(temp);
@@ -184,7 +184,7 @@ char *take_extension(const char *target) {
/* Checks if target exists and prints a debug message if access() failed
except if it failed with ENOENT. */
-bool file_exists(const char *target) {
+bool fexists(const char *target) {
assert(target);
if (!access(target, F_OK))
return true;