summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-08-27 17:21:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:02:53 -0500
commit4fb038b0b8e7a4bb69ac0d9022684eeaca8a491a (patch)
treeb2465bb451c73232e640d2c2718a6af084be2345
parent8a1d019f53ef6d1a6900a005b335bdc10d14bbe4 (diff)
downloadsamba-4fb038b0b8e7a4bb69ac0d9022684eeaca8a491a.tar.gz
samba-4fb038b0b8e7a4bb69ac0d9022684eeaca8a491a.tar.bz2
samba-4fb038b0b8e7a4bb69ac0d9022684eeaca8a491a.zip
r24710: Use standard boolean type for easier use by external users.
(This used to be commit 99f4124137d4a61216e8189f26d4da32882c0f4a)
-rw-r--r--source4/lib/util/capability.c16
-rw-r--r--source4/lib/util/debug.c13
-rw-r--r--source4/lib/util/debug.h4
-rw-r--r--source4/lib/util/fault.c6
-rw-r--r--source4/lib/util/genrand.c16
-rw-r--r--source4/lib/util/module.c10
-rw-r--r--source4/lib/util/mutex.c6
-rw-r--r--source4/lib/util/signal.c2
-rw-r--r--source4/lib/util/tests/strlist.c8
-rw-r--r--source4/lib/util/time.c16
-rw-r--r--source4/lib/util/util.c58
-rw-r--r--source4/lib/util/util_file.c14
-rw-r--r--source4/lib/util/util_str.c64
-rw-r--r--source4/lib/util/util_strlist.c34
-rw-r--r--source4/lib/util/util_tdb.c24
15 files changed, 146 insertions, 145 deletions
diff --git a/source4/lib/util/capability.c b/source4/lib/util/capability.c
index d42d13e008..2d13826c14 100644
--- a/source4/lib/util/capability.c
+++ b/source4/lib/util/capability.c
@@ -37,7 +37,7 @@
/**************************************************************************
Try and abstract process capabilities (for systems that have them).
****************************************************************************/
-static BOOL set_process_capability( uint32_t cap_flag, BOOL enable )
+static bool set_process_capability( uint32_t cap_flag, bool enable )
{
if(cap_flag == KERNEL_OPLOCK_CAPABILITY) {
cap_t cap = cap_get_proc();
@@ -45,7 +45,7 @@ static BOOL set_process_capability( uint32_t cap_flag, BOOL enable )
if (cap == NULL) {
DEBUG(0,("set_process_capability: cap_get_proc failed. Error was %s\n",
strerror(errno)));
- return False;
+ return false;
}
if(enable)
@@ -57,21 +57,21 @@ static BOOL set_process_capability( uint32_t cap_flag, BOOL enable )
DEBUG(0,("set_process_capability: cap_set_proc failed. Error was %s\n",
strerror(errno)));
cap_free(cap);
- return False;
+ return false;
}
cap_free(cap);
DEBUG(10,("set_process_capability: Set KERNEL_OPLOCK_CAPABILITY.\n"));
}
- return True;
+ return true;
}
/**************************************************************************
Try and abstract inherited process capabilities (for systems that have them).
****************************************************************************/
-static BOOL set_inherited_process_capability( uint32_t cap_flag, BOOL enable )
+static bool set_inherited_process_capability( uint32_t cap_flag, bool enable )
{
if(cap_flag == KERNEL_OPLOCK_CAPABILITY) {
cap_t cap = cap_get_proc();
@@ -79,7 +79,7 @@ static BOOL set_inherited_process_capability( uint32_t cap_flag, BOOL enable )
if (cap == NULL) {
DEBUG(0,("set_inherited_process_capability: cap_get_proc failed. Error was %s\n",
strerror(errno)));
- return False;
+ return false;
}
if(enable)
@@ -91,13 +91,13 @@ static BOOL set_inherited_process_capability( uint32_t cap_flag, BOOL enable )
DEBUG(0,("set_inherited_process_capability: cap_set_proc failed. Error was %s\n",
strerror(errno)));
cap_free(cap);
- return False;
+ return false;
}
cap_free(cap);
DEBUG(10,("set_inherited_process_capability: Set KERNEL_OPLOCK_CAPABILITY.\n"));
}
- return True;
+ return true;
}
#endif
diff --git a/source4/lib/util/debug.c b/source4/lib/util/debug.c
index c29b3bfaec..67663cb6ce 100644
--- a/source4/lib/util/debug.c
+++ b/source4/lib/util/debug.c
@@ -46,22 +46,23 @@ static struct {
const char *prog_name;
} state;
-static BOOL reopen_logs_scheduled;
-static BOOL check_reopen_logs(void)
+static bool reopen_logs_scheduled;
+static bool check_reopen_logs(void)
{
if (state.fd == 0 || reopen_logs_scheduled) {
- reopen_logs_scheduled = False;
+ reopen_logs_scheduled = false;
reopen_logs();
}
- if (state.fd <= 0) return False;
+ if (state.fd <= 0)
+ return false;
- return True;
+ return true;
}
_PUBLIC_ void debug_schedule_reopen_logs(void)
{
- reopen_logs_scheduled = True;
+ reopen_logs_scheduled = true;
}
static void log_timestring(int level, const char *location, const char *func)
diff --git a/source4/lib/util/debug.h b/source4/lib/util/debug.h
index 2f090359a5..4fa2e9f598 100644
--- a/source4/lib/util/debug.h
+++ b/source4/lib/util/debug.h
@@ -53,11 +53,11 @@ extern int DEBUGLEVEL;
/**
* Write to the debug log.
*/
-#define DEBUG(level, body) _DEBUG(level, body, True)
+#define DEBUG(level, body) _DEBUG(level, body, true)
/**
* Add data to an existing debug log entry.
*/
-#define DEBUGADD(level, body) _DEBUG(level, body, False)
+#define DEBUGADD(level, body) _DEBUG(level, body, false)
/**
* Obtain indentation string for the debug log.
diff --git a/source4/lib/util/fault.c b/source4/lib/util/fault.c
index 8bfcdff0d1..5cc9445407 100644
--- a/source4/lib/util/fault.c
+++ b/source4/lib/util/fault.c
@@ -208,18 +208,18 @@ _PUBLIC_ void fault_setup(const char *pname)
register a fault handler.
Should only be called once in the execution of smbd.
*/
-_PUBLIC_ BOOL register_fault_handler(const char *name, void (*fault_handler)(int sig))
+_PUBLIC_ bool register_fault_handler(const char *name, void (*fault_handler)(int sig))
{
if (fault_handlers.name != NULL) {
/* it's already registered! */
DEBUG(2,("fault handler '%s' already registered - failed '%s'\n",
fault_handlers.name, name));
- return False;
+ return false;
}
fault_handlers.name = name;
fault_handlers.fault_handler = fault_handler;
DEBUG(2,("fault handler '%s' registered\n", name));
- return True;
+ return true;
}
diff --git a/source4/lib/util/genrand.c b/source4/lib/util/genrand.c
index 2c3875750e..4d976cecf8 100644
--- a/source4/lib/util/genrand.c
+++ b/source4/lib/util/genrand.c
@@ -32,7 +32,7 @@
static unsigned char hash[258];
static uint32_t counter;
-static BOOL done_reseed = False;
+static bool done_reseed = false;
static void (*reseed_callback)(int *newseed);
/**
@@ -50,7 +50,7 @@ _PUBLIC_ void set_rand_reseed_callback(void (*fn)(int *))
*/
_PUBLIC_ void set_need_random_reseed(void)
{
- done_reseed = False;
+ done_reseed = false;
}
static void get_rand_reseed_data(int *reseed_data)
@@ -156,7 +156,7 @@ static void do_filehash(const char *fname, unsigned char *the_hash)
above...
**************************************************************/
-static int do_reseed(BOOL use_fd, int fd)
+static int do_reseed(bool use_fd, int fd)
{
unsigned char seed_inbuf[40];
uint32_t v1, v2; struct timeval tval; pid_t mypid;
@@ -214,8 +214,8 @@ _PUBLIC_ void generate_random_buffer(uint8_t *out, int len)
unsigned char *p;
if(!done_reseed) {
- urand_fd = do_reseed(True, urand_fd);
- done_reseed = True;
+ urand_fd = do_reseed(true, urand_fd);
+ done_reseed = true;
}
if (urand_fd != -1 && len > 0) {
@@ -226,8 +226,8 @@ _PUBLIC_ void generate_random_buffer(uint8_t *out, int len)
/* Read of urand error, drop back to non urand method. */
close(urand_fd);
urand_fd = -1;
- do_reseed(False, -1);
- done_reseed = True;
+ do_reseed(false, -1);
+ done_reseed = true;
}
/*
@@ -263,7 +263,7 @@ _PUBLIC_ uint32_t generate_random(void)
/**
very basic password quality checker
**/
-_PUBLIC_ BOOL check_password_quality(const char *s)
+_PUBLIC_ bool check_password_quality(const char *s)
{
int has_digit=0, has_capital=0, has_lower=0, has_special=0, has_high=0;
while (*s) {
diff --git a/source4/lib/util/module.c b/source4/lib/util/module.c
index 096b21b8a9..170ea0bacb 100644
--- a/source4/lib/util/module.c
+++ b/source4/lib/util/module.c
@@ -95,17 +95,17 @@ _PUBLIC_ init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path)
/**
* Run the specified init functions.
*
- * @return True if all functions ran successfully, False otherwise
+ * @return true if all functions ran successfully, false otherwise
*/
-_PUBLIC_ BOOL run_init_functions(NTSTATUS (**fns) (void))
+_PUBLIC_ bool run_init_functions(NTSTATUS (**fns) (void))
{
int i;
- BOOL ret = True;
+ bool ret = true;
if (fns == NULL)
- return True;
+ return true;
- for (i = 0; fns[i]; i++) { ret &= (BOOL)NT_STATUS_IS_OK(fns[i]()); }
+ for (i = 0; fns[i]; i++) { ret &= (bool)NT_STATUS_IS_OK(fns[i]()); }
return ret;
}
diff --git a/source4/lib/util/mutex.c b/source4/lib/util/mutex.c
index ec7e9dfd2e..4d0df68eed 100644
--- a/source4/lib/util/mutex.c
+++ b/source4/lib/util/mutex.c
@@ -38,19 +38,19 @@ static struct {
register a set of mutex/rwlock handlers.
Should only be called once in the execution of smbd.
*/
-_PUBLIC_ BOOL register_mutex_handlers(const char *name, struct mutex_ops *ops)
+_PUBLIC_ bool register_mutex_handlers(const char *name, struct mutex_ops *ops)
{
if (mutex_handlers.name != NULL) {
/* it's already registered! */
DEBUG(2,("mutex handler '%s' already registered - failed '%s'\n",
mutex_handlers.name, name));
- return False;
+ return false;
}
mutex_handlers.name = name;
mutex_handlers.ops = *ops;
DEBUG(2,("mutex handler '%s' registered\n", name));
- return True;
+ return true;
}
diff --git a/source4/lib/util/signal.c b/source4/lib/util/signal.c
index 5639f98416..ead947eb5e 100644
--- a/source4/lib/util/signal.c
+++ b/source4/lib/util/signal.c
@@ -69,7 +69,7 @@ static void sig_cld_leave_status(int signum)
Block sigs.
**/
-void BlockSignals(BOOL block,int signum)
+void BlockSignals(bool block, int signum)
{
#ifdef HAVE_SIGPROCMASK
sigset_t set;
diff --git a/source4/lib/util/tests/strlist.c b/source4/lib/util/tests/strlist.c
index 689e03e54a..41accd4bd2 100644
--- a/source4/lib/util/tests/strlist.c
+++ b/source4/lib/util/tests/strlist.c
@@ -37,7 +37,7 @@ static bool test_lists_shell(struct torture_context *tctx,
{
const char *data = test_data;
const char **ret1, **ret2, *tmp;
- BOOL match = True;
+ bool match = true;
TALLOC_CTX *mem_ctx = tctx;
ret1 = str_list_make_shell(mem_ctx, data, " ");
@@ -45,18 +45,18 @@ static bool test_lists_shell(struct torture_context *tctx,
ret2 = str_list_make_shell(mem_ctx, tmp, " ");
if ((ret1 == NULL || ret2 == NULL) && ret2 != ret1) {
- match = False;
+ match = false;
} else {
int j;
for (j = 0; ret1[j] && ret2[j]; j++) {
if (strcmp(ret1[j], ret2[j]) != 0) {
- match = False;
+ match = false;
break;
}
}
if (ret1[j] || ret2[j])
- match = False;
+ match = false;
}
torture_assert(tctx, match, talloc_asprintf(tctx,
diff --git a/source4/lib/util/time.c b/source4/lib/util/time.c
index e5d7e2bca5..c800fffea0 100644
--- a/source4/lib/util/time.c
+++ b/source4/lib/util/time.c
@@ -116,7 +116,7 @@ _PUBLIC_ void unix_to_nt_time(NTTIME *nt, time_t t)
/**
check if it's a null unix time
**/
-_PUBLIC_ BOOL null_time(time_t t)
+_PUBLIC_ bool null_time(time_t t)
{
return t == 0 ||
t == (time_t)0xFFFFFFFF ||
@@ -127,7 +127,7 @@ _PUBLIC_ BOOL null_time(time_t t)
/**
check if it's a null NTTIME
**/
-_PUBLIC_ BOOL null_nttime(NTTIME t)
+_PUBLIC_ bool null_nttime(NTTIME t)
{
return t == 0 || t == (NTTIME)-1;
}
@@ -403,9 +403,9 @@ _PUBLIC_ struct timeval timeval_zero(void)
}
/**
- return True if a timeval is zero
+ return true if a timeval is zero
*/
-_PUBLIC_ BOOL timeval_is_zero(const struct timeval *tv)
+_PUBLIC_ bool timeval_is_zero(const struct timeval *tv)
{
return tv->tv_sec == 0 && tv->tv_usec == 0;
}
@@ -481,13 +481,13 @@ _PUBLIC_ int timeval_compare(const struct timeval *tv1, const struct timeval *tv
}
/**
- return True if a timer is in the past
+ return true if a timer is in the past
*/
-_PUBLIC_ BOOL timeval_expired(const struct timeval *tv)
+_PUBLIC_ bool timeval_expired(const struct timeval *tv)
{
struct timeval tv2 = timeval_current();
- if (tv2.tv_sec > tv->tv_sec) return True;
- if (tv2.tv_sec < tv->tv_sec) return False;
+ if (tv2.tv_sec > tv->tv_sec) return true;
+ if (tv2.tv_sec < tv->tv_sec) return false;
return (tv2.tv_usec >= tv->tv_usec);
}
diff --git a/source4/lib/util/util.c b/source4/lib/util/util.c
index e43bb98c1e..aa7a571585 100644
--- a/source4/lib/util/util.c
+++ b/source4/lib/util/util.c
@@ -47,12 +47,12 @@ _PUBLIC_ const char *tmpdir(void)
/**
Check if a file exists - call vfs_file_exist for samba files.
**/
-_PUBLIC_ BOOL file_exist(const char *fname)
+_PUBLIC_ bool file_exist(const char *fname)
{
struct stat st;
if (stat(fname, &st) != 0) {
- return False;
+ return false;
}
return ((S_ISREG(st.st_mode)) || (S_ISFIFO(st.st_mode)));
@@ -76,13 +76,13 @@ _PUBLIC_ time_t file_modtime(const char *fname)
Check if a directory exists.
**/
-_PUBLIC_ BOOL directory_exist(const char *dname)
+_PUBLIC_ bool directory_exist(const char *dname)
{
struct stat st;
- BOOL ret;
+ bool ret;
if (stat(dname,&st) != 0) {
- return False;
+ return false;
}
ret = S_ISDIR(st.st_mode);
@@ -94,10 +94,10 @@ _PUBLIC_ BOOL directory_exist(const char *dname)
/**
* Try to create the specified directory if it didn't exist.
*
- * @retval True if the directory already existed and has the right permissions
+ * @retval true if the directory already existed and has the right permissions
* or was successfully created.
*/
-_PUBLIC_ BOOL directory_create_or_exist(const char *dname, uid_t uid,
+_PUBLIC_ bool directory_create_or_exist(const char *dname, uid_t uid,
mode_t dir_perms)
{
mode_t old_umask;
@@ -112,13 +112,13 @@ _PUBLIC_ BOOL directory_create_or_exist(const char *dname, uid_t uid,
"%s: %s\n", dname,
strerror(errno)));
umask(old_umask);
- return False;
+ return false;
}
} else {
DEBUG(0, ("lstat failed on directory %s: %s\n",
dname, strerror(errno)));
umask(old_umask);
- return False;
+ return false;
}
} else {
/* Check ownership and permission on existing directory */
@@ -126,17 +126,17 @@ _PUBLIC_ BOOL directory_create_or_exist(const char *dname, uid_t uid,
DEBUG(0, ("directory %s isn't a directory\n",
dname));
umask(old_umask);
- return False;
+ return false;
}
if ((st.st_uid != uid) ||
((st.st_mode & 0777) != dir_perms)) {
DEBUG(0, ("invalid permissions on directory "
"%s\n", dname));
umask(old_umask);
- return False;
+ return false;
}
}
- return True;
+ return true;
}
@@ -147,7 +147,7 @@ _PUBLIC_ BOOL directory_create_or_exist(const char *dname, uid_t uid,
if BSD use FNDELAY
**/
-_PUBLIC_ int set_blocking(int fd, BOOL set)
+_PUBLIC_ int set_blocking(int fd, bool set)
{
int val;
#ifdef O_NONBLOCK
@@ -221,16 +221,16 @@ _PUBLIC_ char* get_myname(void)
Return true if a string could be a pure IP address.
**/
-_PUBLIC_ BOOL is_ipaddress(const char *str)
+_PUBLIC_ bool is_ipaddress(const char *str)
{
- BOOL pure_address = True;
+ bool pure_address = true;
int i;
- if (str == NULL) return False;
+ if (str == NULL) return false;
for (i=0; pure_address && str[i]; i++)
if (!(isdigit((int)str[i]) || str[i] == '.'))
- pure_address = False;
+ pure_address = false;
/* Check that a pure number is not misinterpreted as an IP */
pure_address = pure_address && (strchr(str, '.') != NULL);
@@ -298,7 +298,7 @@ _PUBLIC_ struct ipv4_addr interpret_addr2(const char *str)
Check if an IP is the 0.0.0.0.
**/
-_PUBLIC_ BOOL is_zero_ip(struct ipv4_addr ip)
+_PUBLIC_ bool is_zero_ip(struct ipv4_addr ip)
{
return ip.addr == 0;
}
@@ -307,7 +307,7 @@ _PUBLIC_ BOOL is_zero_ip(struct ipv4_addr ip)
Are two IPs on the same subnet?
**/
-_PUBLIC_ BOOL same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_addr mask)
+_PUBLIC_ bool same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_addr mask)
{
uint32_t net1,net2,nmask;
@@ -323,7 +323,7 @@ _PUBLIC_ BOOL same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_add
Check if a process exists. Does this work on all unixes?
**/
-_PUBLIC_ BOOL process_exists(pid_t pid)
+_PUBLIC_ bool process_exists(pid_t pid)
{
/* Doing kill with a non-positive pid causes messages to be
* sent to places we don't want. */
@@ -336,7 +336,7 @@ _PUBLIC_ BOOL process_exists(pid_t pid)
is dealt with in posix.c
**/
-_PUBLIC_ BOOL fcntl_lock(int fd, int op, off_t offset, off_t count, int type)
+_PUBLIC_ bool fcntl_lock(int fd, int op, off_t offset, off_t count, int type)
{
struct flock lock;
int ret;
@@ -361,24 +361,24 @@ _PUBLIC_ BOOL fcntl_lock(int fd, int op, off_t offset, off_t count, int type)
(lock.l_pid != 0) &&
(lock.l_pid != getpid())) {
DEBUG(3,("fcntl_lock: fd %d is locked by pid %d\n",fd,(int)lock.l_pid));
- return(True);
+ return true;
}
/* it must be not locked or locked by me */
- return(False);
+ return false;
}
/* a lock set or unset */
if (ret == -1) {
DEBUG(3,("fcntl_lock: lock failed at offset %.0f count %.0f op %d type %d (%s)\n",
(double)offset,(double)count,op,type,strerror(errno)));
- return(False);
+ return false;
}
/* everything went OK */
DEBUG(8,("fcntl_lock: Lock call successful\n"));
- return(True);
+ return true;
}
@@ -503,14 +503,14 @@ _PUBLIC_ void dump_data_pw(const char *msg, const uint8_t * data, size_t len)
* see if a range of memory is all zero. A NULL pointer is considered
* to be all zero
*/
-_PUBLIC_ BOOL all_zero(const uint8_t *ptr, size_t size)
+_PUBLIC_ bool all_zero(const uint8_t *ptr, size_t size)
{
int i;
- if (!ptr) return True;
+ if (!ptr) return true;
for (i=0;i<size;i++) {
- if (ptr[i]) return False;
+ if (ptr[i]) return false;
}
- return True;
+ return true;
}
/**
diff --git a/source4/lib/util/util_file.c b/source4/lib/util/util_file.c
index a7ba048692..836e188ac1 100644
--- a/source4/lib/util/util_file.c
+++ b/source4/lib/util/util_file.c
@@ -38,7 +38,7 @@ _PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f)
char *s=s2;
int len = 0;
int c;
- BOOL start_of_line = True;
+ bool start_of_line = true;
if (x_feof(f))
return(NULL);
@@ -70,7 +70,7 @@ _PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f)
if (len > 0 && s[len-1] == '\\')
{
s[--len] = 0;
- start_of_line = True;
+ start_of_line = true;
break;
}
return(s);
@@ -83,7 +83,7 @@ _PUBLIC_ char *fgets_slash(char *s2,int maxlen,XFILE *f)
break;
/* fall through */
default:
- start_of_line = False;
+ start_of_line = false;
s[len++] = c;
s[len] = 0;
}
@@ -342,18 +342,18 @@ _PUBLIC_ void file_lines_slashcont(char **lines)
/**
save a lump of data into a file. Mostly used for debugging
*/
-_PUBLIC_ BOOL file_save(const char *fname, const void *packet, size_t length)
+_PUBLIC_ bool file_save(const char *fname, const void *packet, size_t length)
{
int fd;
fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0644);
if (fd == -1) {
- return False;
+ return false;
}
if (write(fd, packet, length) != (size_t)length) {
- return False;
+ return false;
}
close(fd);
- return True;
+ return true;
}
_PUBLIC_ int vfdprintf(int fd, const char *format, va_list ap) _PRINTF_ATTRIBUTE(2,0)
diff --git a/source4/lib/util/util_str.c b/source4/lib/util/util_str.c
index baa42e806a..67e59474fd 100644
--- a/source4/lib/util/util_str.c
+++ b/source4/lib/util/util_str.c
@@ -263,16 +263,16 @@ _PUBLIC_ char *hex_encode_talloc(TALLOC_CTX *mem_ctx, const unsigned char *buff_
/**
Set a string value, allocing the space for the string
**/
-static BOOL string_init(char **dest,const char *src)
+static bool string_init(char **dest,const char *src)
{
if (!src) src = "";
(*dest) = strdup(src);
if ((*dest) == NULL) {
DEBUG(0,("Out of memory in string_init\n"));
- return False;
+ return false;
}
- return True;
+ return true;
}
/**
@@ -287,7 +287,7 @@ _PUBLIC_ void string_free(char **s)
Set a string value, deallocating any existing space, and allocing the space
for the string
**/
-_PUBLIC_ BOOL string_set(char **dest, const char *src)
+_PUBLIC_ bool string_set(char **dest, const char *src)
{
string_free(dest);
return string_init(dest,src);
@@ -485,7 +485,7 @@ _PUBLIC_ const char *str_format_nbt_domain(TALLOC_CTX *mem_ctx, const char *s)
* num should be a pointer to an integer that holds the current
* number of elements in strings. It will be updated by this function.
*/
-_PUBLIC_ BOOL add_string_to_array(TALLOC_CTX *mem_ctx,
+_PUBLIC_ bool add_string_to_array(TALLOC_CTX *mem_ctx,
const char *str, const char ***strings, int *num)
{
char *dup_str = talloc_strdup(mem_ctx, str);
@@ -495,12 +495,12 @@ _PUBLIC_ BOOL add_string_to_array(TALLOC_CTX *mem_ctx,
const char *, ((*num)+1));
if ((*strings == NULL) || (dup_str == NULL))
- return False;
+ return false;
(*strings)[*num] = dup_str;
*num += 1;
- return True;
+ return true;
}
@@ -584,26 +584,26 @@ _PUBLIC_ char *attrib_string(TALLOC_CTX *mem_ctx, uint32_t attrib)
/**
Set a boolean variable from the text value stored in the passed string.
- Returns True in success, False if the passed string does not correctly
+ Returns true in success, false if the passed string does not correctly
represent a boolean.
**/
-_PUBLIC_ BOOL set_boolean(const char *boolean_string, BOOL *boolean)
+_PUBLIC_ bool set_boolean(const char *boolean_string, bool *boolean)
{
if (strwicmp(boolean_string, "yes") == 0 ||
strwicmp(boolean_string, "true") == 0 ||
strwicmp(boolean_string, "on") == 0 ||
strwicmp(boolean_string, "1") == 0) {
- *boolean = True;
- return True;
+ *boolean = true;
+ return true;
} else if (strwicmp(boolean_string, "no") == 0 ||
strwicmp(boolean_string, "false") == 0 ||
strwicmp(boolean_string, "off") == 0 ||
strwicmp(boolean_string, "0") == 0) {
- *boolean = False;
- return True;
+ *boolean = false;
+ return true;
}
- return False;
+ return false;
}
/**
@@ -611,15 +611,15 @@ _PUBLIC_ BOOL set_boolean(const char *boolean_string, BOOL *boolean)
*
* val will be set to the read value.
*
- * @retval True if a boolean value was parsed, False otherwise.
+ * @retval true if a boolean value was parsed, false otherwise.
*/
-_PUBLIC_ BOOL conv_str_bool(const char * str, BOOL * val)
+_PUBLIC_ bool conv_str_bool(const char * str, bool * val)
{
char * end = NULL;
long lval;
if (str == NULL || *str == '\0') {
- return False;
+ return false;
}
lval = strtol(str, &end, 10 /* base */);
@@ -627,25 +627,25 @@ _PUBLIC_ BOOL conv_str_bool(const char * str, BOOL * val)
return set_boolean(str, val);
}
- *val = (lval) ? True : False;
- return True;
+ *val = (lval) ? true : false;
+ return true;
}
/**
* Convert a size specification like 16K into an integral number of bytes.
**/
-_PUBLIC_ BOOL conv_str_size(const char * str, uint64_t * val)
+_PUBLIC_ bool conv_str_size(const char * str, uint64_t * val)
{
char * end = NULL;
unsigned long long lval;
if (str == NULL || *str == '\0') {
- return False;
+ return false;
}
lval = strtoull(str, &end, 10 /* base */);
if (end == NULL || end == str) {
- return False;
+ return false;
}
if (*end) {
@@ -660,12 +660,12 @@ _PUBLIC_ BOOL conv_str_size(const char * str, uint64_t * val)
} else if (strwicmp(end, "P") == 0) {
lval *= (1024ULL * 1024ULL * 1024ULL * 1024ULL * 1024ULL);
} else {
- return False;
+ return false;
}
}
*val = (uint64_t)lval;
- return True;
+ return true;
}
/**
@@ -673,24 +673,24 @@ _PUBLIC_ BOOL conv_str_size(const char * str, uint64_t * val)
*
* val will be set to the value read.
*
- * @retval True if parsing was successful, False otherwise
+ * @retval true if parsing was successful, false otherwise
*/
-_PUBLIC_ BOOL conv_str_u64(const char * str, uint64_t * val)
+_PUBLIC_ bool conv_str_u64(const char * str, uint64_t * val)
{
char * end = NULL;
unsigned long long lval;
if (str == NULL || *str == '\0') {
- return False;
+ return false;
}
lval = strtoull(str, &end, 10 /* base */);
if (end == NULL || *end != '\0' || end == str) {
- return False;
+ return false;
}
*val = (uint64_t)lval;
- return True;
+ return true;
}
/**
@@ -777,12 +777,12 @@ _PUBLIC_ void string_replace(char *s, char oldc, char newc)
*
* @note The comparison is case-insensitive.
**/
-_PUBLIC_ BOOL strequal(const char *s1, const char *s2)
+_PUBLIC_ bool strequal(const char *s1, const char *s2)
{
if (s1 == s2)
- return(True);
+ return true;
if (!s1 || !s2)
- return(False);
+ return false;
return strcasecmp(s1,s2) == 0;
}
diff --git a/source4/lib/util/util_strlist.c b/source4/lib/util/util_strlist.c
index cd0e1cdac0..ab73fb2d15 100644
--- a/source4/lib/util/util_strlist.c
+++ b/source4/lib/util/util_strlist.c
@@ -217,7 +217,7 @@ _PUBLIC_ const char **str_list_copy(TALLOC_CTX *mem_ctx, const char **list)
/**
Return true if all the elements of the list match exactly.
*/
-_PUBLIC_ BOOL str_list_equal(const char **list1, const char **list2)
+_PUBLIC_ bool str_list_equal(const char **list1, const char **list2)
{
int i;
@@ -227,13 +227,13 @@ _PUBLIC_ BOOL str_list_equal(const char **list1, const char **list2)
for (i=0;list1[i] && list2[i];i++) {
if (strcmp(list1[i], list2[i]) != 0) {
- return False;
+ return false;
}
}
if (list1[i] || list2[i]) {
- return False;
+ return false;
}
- return True;
+ return true;
}
@@ -275,50 +275,50 @@ _PUBLIC_ void str_list_remove(const char **list, const char *s)
/**
- return True if a string is in a list
+ return true if a string is in a list
*/
-_PUBLIC_ BOOL str_list_check(const char **list, const char *s)
+_PUBLIC_ bool str_list_check(const char **list, const char *s)
{
int i;
for (i=0;list[i];i++) {
- if (strcmp(list[i], s) == 0) return True;
+ if (strcmp(list[i], s) == 0) return true;
}
- return False;
+ return false;
}
/**
- return True if a string is in a list, case insensitively
+ return true if a string is in a list, case insensitively
*/
-_PUBLIC_ BOOL str_list_check_ci(const char **list, const char *s)
+_PUBLIC_ bool str_list_check_ci(const char **list, const char *s)
{
int i;
for (i=0;list[i];i++) {
- if (strcasecmp(list[i], s) == 0) return True;
+ if (strcasecmp(list[i], s) == 0) return true;
}
- return False;
+ return false;
}
/**
Check if a string is part of a list.
**/
-_PUBLIC_ BOOL in_list(const char *s, const char *list, BOOL casesensitive)
+_PUBLIC_ bool in_list(const char *s, const char *list, bool casesensitive)
{
pstring tok;
const char *p=list;
if (!list)
- return(False);
+ return false;
while (next_token(&p,tok,LIST_SEP,sizeof(tok))) {
if (casesensitive) {
if (strcmp(tok,s) == 0)
- return(True);
+ return true;
} else {
if (strcasecmp_m(tok,s) == 0)
- return(True);
+ return true;
}
}
- return(False);
+ return false;
}
diff --git a/source4/lib/util/util_tdb.c b/source4/lib/util/util_tdb.c
index 6c95b58893..1112f1587c 100644
--- a/source4/lib/util/util_tdb.c
+++ b/source4/lib/util/util_tdb.c
@@ -148,7 +148,7 @@ int tdb_store_int32(struct tdb_context *tdb, const char *keystr, int32_t v)
Output is uint32_t in native byte order.
****************************************************************************/
-BOOL tdb_fetch_uint32_byblob(struct tdb_context *tdb, const char *keyval, size_t len, uint32_t *value)
+bool tdb_fetch_uint32_byblob(struct tdb_context *tdb, const char *keyval, size_t len, uint32_t *value)
{
TDB_DATA key = make_tdb_data(keyval, len);
TDB_DATA data;
@@ -156,12 +156,12 @@ BOOL tdb_fetch_uint32_byblob(struct tdb_context *tdb, const char *keyval, size_t
data = tdb_fetch(tdb, key);
if (!data.dptr || data.dsize != sizeof(uint32_t)) {
SAFE_FREE(data.dptr);
- return False;
+ return false;
}
*value = IVAL(data.dptr,0);
SAFE_FREE(data.dptr);
- return True;
+ return true;
}
/****************************************************************************
@@ -169,7 +169,7 @@ BOOL tdb_fetch_uint32_byblob(struct tdb_context *tdb, const char *keyval, size_t
Output is uint32_t in native byte order.
****************************************************************************/
-BOOL tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32_t *value)
+bool tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32_t *value)
{
return tdb_fetch_uint32_byblob(tdb, keystr, strlen(keystr) + 1, value);
}
@@ -179,19 +179,19 @@ BOOL tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32_t *val
Input is uint32_t in native byte order. Output in tdb is in little-endian.
****************************************************************************/
-BOOL tdb_store_uint32_byblob(struct tdb_context *tdb, const char *keystr, size_t len, uint32_t value)
+bool tdb_store_uint32_byblob(struct tdb_context *tdb, const char *keystr, size_t len, uint32_t value)
{
TDB_DATA key = make_tdb_data(keystr, len);
TDB_DATA data;
uint32_t v_store;
- BOOL ret = True;
+ bool ret = true;
SIVAL(&v_store, 0, value);
data.dptr = (void *)&v_store;
data.dsize = sizeof(uint32_t);
if (tdb_store(tdb, key, data, TDB_REPLACE) == -1)
- ret = False;
+ ret = false;
return ret;
}
@@ -201,7 +201,7 @@ BOOL tdb_store_uint32_byblob(struct tdb_context *tdb, const char *keystr, size_t
Input is uint32_t in native byte order. Output in tdb is in little-endian.
****************************************************************************/
-BOOL tdb_store_uint32(struct tdb_context *tdb, const char *keystr, uint32_t value)
+bool tdb_store_uint32(struct tdb_context *tdb, const char *keystr, uint32_t value)
{
return tdb_store_uint32_byblob(tdb, keystr, strlen(keystr) + 1, value);
}
@@ -285,13 +285,13 @@ int32_t tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int
Atomic unsigned integer change. Returns old value. To create, set initial value in *oldval.
****************************************************************************/
-BOOL tdb_change_uint32_atomic(struct tdb_context *tdb, const char *keystr, uint32_t *oldval, uint32_t change_val)
+bool tdb_change_uint32_atomic(struct tdb_context *tdb, const char *keystr, uint32_t *oldval, uint32_t change_val)
{
uint32_t val;
- BOOL ret = False;
+ bool ret = false;
if (tdb_lock_bystring(tdb, keystr) == -1)
- return False;
+ return false;
if (!tdb_fetch_uint32(tdb, keystr, &val)) {
/* It failed */
@@ -315,7 +315,7 @@ BOOL tdb_change_uint32_atomic(struct tdb_context *tdb, const char *keystr, uint3
if (!tdb_store_uint32(tdb, keystr, val))
goto err_out;
- ret = True;
+ ret = true;
err_out: