Mercurial > hg > th-libs
diff th_file.c @ 453:efd33accdc81
Break backwards compatibility by renaming BOOL, TRUE and FALSE to lowercase.
Introduce optional but default use of stdbool.h.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Jan 2018 22:56:03 +0200 |
parents | 1b3472ba7b23 |
children | 347bfd3e017e |
line wrap: on
line diff
--- a/th_file.c Wed Oct 25 22:32:07 2017 +0300 +++ b/th_file.c Tue Jan 02 22:56:03 2018 +0200 @@ -69,7 +69,7 @@ } -BOOL th_stat_path(const char *path, int *flags) +bool th_stat_path(const char *path, int *flags) { *flags = 0; @@ -83,22 +83,22 @@ uid_t id = geteuid(); struct stat sb; if (stat(path, &sb) < 0) - return FALSE; + return false; *flags |= S_ISDIR(sb.st_mode) ? TH_IS_DIR : 0; *flags |= (id == sb.st_uid && (sb.st_mode & S_IWUSR)) ? TH_IS_WRITABLE : 0; *flags |= (id == sb.st_uid && (sb.st_mode & S_IRUSR)) ? TH_IS_READABLE : 0; #endif - return TRUE; + return true; } -BOOL th_mkdir_path(const char *cpath, int mode) +bool th_mkdir_path(const char *cpath, int mode) { char save, *path = th_strdup(cpath); size_t start = 0, end; - BOOL res = FALSE; + bool res = false; // If mode is 0, default to something sensible if (mode == 0) @@ -120,7 +120,7 @@ if (path[start] != 0) { int flags; - BOOL exists = th_stat_path(path, &flags); + bool exists = th_stat_path(path, &flags); if (exists && (flags & TH_IS_DIR) == 0) goto error; @@ -141,7 +141,7 @@ start = end + 1; } while (save != 0); - res = TRUE; + res = true; error: th_free(path);