diff options
author | Mike Frysinger <vapier@gentoo.org> | 2008-11-10 21:43:08 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2008-11-10 21:43:08 +0000 |
commit | e04e46ef28233efd013b3226eec88ca9742df8b2 (patch) | |
tree | 90e41dc11c059f5d4a9ccfbae14aa891ef444b8c /libsbutil/src | |
parent | check for backtrace and stdbool.h/elf.h/execinfo.h (diff) | |
download | sandbox-e04e46ef28233efd013b3226eec88ca9742df8b2.tar.gz sandbox-e04e46ef28233efd013b3226eec88ca9742df8b2.tar.bz2 sandbox-e04e46ef28233efd013b3226eec88ca9742df8b2.zip |
libsbutil: convert to stdbool.h
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsbutil/src')
-rw-r--r-- | libsbutil/src/config.c | 4 | ||||
-rw-r--r-- | libsbutil/src/debug.c | 42 | ||||
-rw-r--r-- | libsbutil/src/dynbuf.c | 18 | ||||
-rw-r--r-- | libsbutil/src/file.c | 36 |
4 files changed, 50 insertions, 50 deletions
diff --git a/libsbutil/src/config.c b/libsbutil/src/config.c index a0cfb42..7a2251a 100644 --- a/libsbutil/src/config.c +++ b/libsbutil/src/config.c @@ -29,14 +29,14 @@ rc_get_cnf_entry (const char *pathname, const char *entry, const char *sep) return NULL; /* If it is not a file or symlink pointing to a file, bail */ - if (!rc_is_file (pathname, TRUE)) + if (!rc_is_file (pathname, true)) { rc_errno_set (ENOENT); DBG_MSG ("'%s' is not a file or does not exist!\n", pathname); return NULL; } - if (0 == rc_get_size (pathname, TRUE)) + if (0 == rc_get_size (pathname, true)) { /* XXX: Should we set errno here ? */ DBG_MSG ("'%s' have a size of 0!\n", pathname); diff --git a/libsbutil/src/debug.c b/libsbutil/src/debug.c index 26f926a..1e2a28d 100644 --- a/libsbutil/src/debug.c +++ b/libsbutil/src/debug.c @@ -11,7 +11,7 @@ #include "headers.h" #include "rcscripts/rcutil.h" -volatile static bool debug_enabled = TRUE; +volatile static bool debug_enabled = true; volatile static int debug_errno = 0; static char log_domain_default[] = "rcscripts"; @@ -116,45 +116,45 @@ inline bool check_ptr (const void *ptr) { if (NULL == ptr) - return FALSE; + return false; - return TRUE; + return true; } inline bool check_str (const char *str) { if ((NULL == str) || (0 == strlen (str))) - return FALSE; + return false; - return TRUE; + return true; } inline bool check_strv (char **str) { if ((NULL == str) || (NULL == *str) || (0 == strlen (*str))) - return FALSE; + return false; - return TRUE; + return true; } inline bool check_fd (int fd) { if ((0 >= fd) || (-1 == fcntl (fd, F_GETFL))) - return FALSE; + return false; - return TRUE; + return true; } inline bool check_fp (FILE *fp) { if ((NULL == fp) || (-1 == fileno (fp))) - return FALSE; + return false; - return TRUE; + return true; } inline bool @@ -166,10 +166,10 @@ __check_arg_ptr (const void *ptr, const char *file, const char *func, size_t lin debug_message (file, func, line, "Invalid pointer passed!\n"); - return FALSE; + return false; } - return TRUE; + return true; } inline bool @@ -181,10 +181,10 @@ __check_arg_str (const char *str, const char *file, const char *func, size_t lin debug_message (file, func, line, "Invalid string passed!\n"); - return FALSE; + return false; } - return TRUE; + return true; } inline bool @@ -196,10 +196,10 @@ __check_arg_strv (char **str, const char *file, const char *func, size_t line) debug_message (file, func, line, "Invalid string array passed!\n"); - return FALSE; + return false; } - return TRUE; + return true; } inline bool @@ -211,10 +211,10 @@ __check_arg_fd (int fd, const char *file, const char *func, size_t line) debug_message (file, func, line, "Invalid file descriptor passed!\n"); - return FALSE; + return false; } - return TRUE; + return true; } inline bool @@ -226,10 +226,10 @@ __check_arg_fp (FILE *fp, const char *file, const char *func, size_t line) debug_message (file, func, line, "Invalid file descriptor passed!\n"); - return FALSE; + return false; } - return TRUE; + return true; } inline void * diff --git a/libsbutil/src/dynbuf.c b/libsbutil/src/dynbuf.c index c9186a7..0274ab4 100644 --- a/libsbutil/src/dynbuf.c +++ b/libsbutil/src/dynbuf.c @@ -34,7 +34,7 @@ rc_dynbuf_new (void) dynbuf->length = DYNAMIC_BUFFER_SIZE; dynbuf->rd_index = 0; dynbuf->wr_index = 0; - dynbuf->file_map = FALSE; + dynbuf->file_map = false; return dynbuf; } @@ -58,7 +58,7 @@ rc_dynbuf_new_mmap_file (const char *name) dynbuf->wr_index = dynbuf->length; dynbuf->rd_index = 0; - dynbuf->file_map = TRUE; + dynbuf->file_map = true; return dynbuf; } @@ -434,21 +434,21 @@ bool rc_dynbuf_read_eof (rc_dynbuf_t *dynbuf) { if (!rc_check_arg_dynbuf (dynbuf)) - return FALSE; + return false; if (dynbuf->rd_index >= dynbuf->wr_index) - return TRUE; + return true; - return FALSE; + return false; } inline bool rc_check_dynbuf (rc_dynbuf_t *dynbuf) { if ((NULL == dynbuf) || (NULL == dynbuf->data) || (0 == dynbuf->length)) - return FALSE; + return false; - return TRUE; + return true; } inline bool @@ -461,8 +461,8 @@ __rc_check_arg_dynbuf (rc_dynbuf_t *dynbuf, const char *file, const char *func, debug_message (file, func, line, "Invalid dynamic buffer passed!\n"); - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/libsbutil/src/file.c b/libsbutil/src/file.c index 5956406..8313fd6 100644 --- a/libsbutil/src/file.c +++ b/libsbutil/src/file.c @@ -18,13 +18,13 @@ rc_file_exists (const char *pathname) int retval; if (!check_str (pathname)) - return FALSE; + return false; retval = lstat (pathname, &buf); if (-1 != retval) - retval = TRUE; + retval = true; else - retval = FALSE; + retval = false; return retval; } @@ -36,13 +36,13 @@ rc_is_file (const char *pathname, bool follow_link) int retval; if (!check_str (pathname)) - return FALSE; + return false; retval = follow_link ? stat (pathname, &buf) : lstat (pathname, &buf); if ((-1 != retval) && (S_ISREG (buf.st_mode))) - retval = TRUE; + retval = true; else - retval = FALSE; + retval = false; return retval; } @@ -54,13 +54,13 @@ rc_is_link (const char *pathname) int retval; if (!check_str (pathname)) - return FALSE; + return false; retval = lstat (pathname, &buf); if ((-1 != retval) && (S_ISLNK (buf.st_mode))) - retval = TRUE; + retval = true; else - retval = FALSE; + retval = false; return retval; } @@ -72,13 +72,13 @@ rc_is_dir (const char *pathname, bool follow_link) int retval; if (!check_str (pathname)) - return FALSE; + return false; retval = follow_link ? stat (pathname, &buf) : lstat (pathname, &buf); if ((-1 != retval) && (S_ISDIR (buf.st_mode))) - retval = TRUE; + retval = true; else - retval = FALSE; + retval = false; return retval; } @@ -128,7 +128,7 @@ remove (const char *pathname) if (!check_arg_str (pathname)) return -1; - if (rc_is_dir (pathname, FALSE)) + if (rc_is_dir (pathname, false)) retval = rmdir (pathname); else retval = unlink (pathname); @@ -196,7 +196,7 @@ rc_mktree (const char *pathname, mode_t mode) } /* Not a directory or symlink pointing to a directory */ } - else if (!rc_is_dir (temp_name, TRUE)) + else if (!rc_is_dir (temp_name, true)) { rc_errno_set (ENOTDIR); DBG_MSG ("Component in '%s' is not a directory!\n", temp_name); @@ -239,7 +239,7 @@ rc_rmtree (const char *pathname) return -1; } - if (!rc_is_dir (pathname, FALSE)) + if (!rc_is_dir (pathname, false)) { rc_errno_set (ENOTDIR); DBG_MSG ("'%s' is not a directory!\n", pathname); @@ -247,7 +247,7 @@ rc_rmtree (const char *pathname) } - dirlist = rc_ls_dir (pathname, TRUE, FALSE); + dirlist = rc_ls_dir (pathname, true, false); if ((NULL == dirlist) && (rc_errno_is_set ())) { /* Do not error out - caller should decide itself if it @@ -260,7 +260,7 @@ rc_rmtree (const char *pathname) { /* If it is a directory, call rc_rmtree() again with * it as argument */ - if (rc_is_dir (dirlist[i], FALSE)) + if (rc_is_dir (dirlist[i], false)) { if (-1 == rc_rmtree (dirlist[i])) { @@ -307,7 +307,7 @@ rc_ls_dir (const char *pathname, bool hidden, bool sort) if (!check_arg_str (pathname)) return NULL; - if (!rc_is_dir (pathname, TRUE)) + if (!rc_is_dir (pathname, true)) { /* XXX: Should we error here? */ DBG_MSG ("'%s' is not a directory.\n", pathname); |