summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-10-06 16:35:39 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-10-07 17:45:20 +1100
commit80e439453d4c0f6e160745826c561dd99e2bd167 (patch)
tree5589d73e0ff6a6c98a663bd2c08a543aa192556b
parent516ee5f0b04143b72239fae53ec34e4b6e3ca0d7 (diff)
downloadsamba-80e439453d4c0f6e160745826c561dd99e2bd167.tar.gz
samba-80e439453d4c0f6e160745826c561dd99e2bd167.tar.bz2
samba-80e439453d4c0f6e160745826c561dd99e2bd167.zip
param: Use a bool to hold boolean parameters
All three-state parameters invoking Auto (2) are already declared as integers, not booleans. Andrew Bartlett
-rw-r--r--script/mkparamdefs.pl2
-rw-r--r--source4/param/loadparm.c14
2 files changed, 8 insertions, 8 deletions
diff --git a/script/mkparamdefs.pl b/script/mkparamdefs.pl
index eacdebd12a..b489cc9277 100644
--- a/script/mkparamdefs.pl
+++ b/script/mkparamdefs.pl
@@ -130,7 +130,7 @@ sub handle_loadparm($$$)
return;
}
my %tmap = (
- "BOOL" => "int ",
+ "BOOL" => "bool ",
"CONST_STRING" => "char *",
"STRING" => "char *",
"INTEGER" => "int ",
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 524fd26df3..a9fa002931 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -2132,7 +2132,7 @@ static void copy_service(struct loadparm_service *pserviceDest,
switch (parm_table[i].type) {
case P_BOOL:
- *(int *)dest_ptr = *(int *)src_ptr;
+ *(bool *)dest_ptr = *(bool *)src_ptr;
break;
case P_INTEGER:
@@ -2506,7 +2506,7 @@ static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr,
DEBUG(0,("lp_do_parameter(%s): value is not boolean!\n", pszParmValue));
return false;
}
- *(int *)parm_ptr = b;
+ *(bool *)parm_ptr = b;
}
break;
@@ -2516,7 +2516,7 @@ static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr,
DEBUG(0,("lp_do_parameter(%s): value is not boolean!\n", pszParmValue));
return false;
}
- *(int *)parm_ptr = !b;
+ *(bool *)parm_ptr = !b;
}
break;
@@ -2837,11 +2837,11 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
break;
case P_BOOL:
- fprintf(f, "%s", BOOLSTR((bool)*(int *)ptr));
+ fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
break;
case P_BOOLREV:
- fprintf(f, "%s", BOOLSTR(!(bool)*(int *)ptr));
+ fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
break;
case P_INTEGER:
@@ -2892,7 +2892,7 @@ static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
switch (type) {
case P_BOOL:
case P_BOOLREV:
- return (*((int *)ptr1) == *((int *)ptr2));
+ return (*((bool *)ptr1) == *((bool *)ptr2));
case P_INTEGER:
case P_OCTAL:
@@ -2992,7 +2992,7 @@ static bool is_default(struct loadparm_service *sDefault, int i)
case P_BOOL:
case P_BOOLREV:
return parm_table[i].def.bvalue ==
- *(int *)def_ptr;
+ *(bool *)def_ptr;
case P_INTEGER:
case P_CHAR:
case P_OCTAL: