RIP BOOL. Convert BOOL -> bool. I found a few interesting
[abartlet/samba.git/.git] / source3 / nmbd / nmbd_become_lmb.c
index c536deb6f45e21525598146f6b90d1491733dc27..8aedd2c4785d0823ca081f3d52ad26195af8576d 100644 (file)
@@ -7,7 +7,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -16,8 +16,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
 */
 
@@ -72,7 +71,7 @@ static void remove_permanent_name_from_unicast( struct subnet_record *subrec,
 ******************************************************************/
 
 static void reset_workgroup_state( struct subnet_record *subrec, const char *workgroup_name,
-                                   BOOL force_new_election )
+                                   bool force_new_election )
 {
        struct work_record *work;
        struct server_record *servrec;
@@ -134,10 +133,10 @@ static void unbecome_local_master_success(struct subnet_record *subrec,
                              struct nmb_name *released_name,
                              struct in_addr released_ip)
 { 
-       BOOL force_new_election = False;
+       bool force_new_election = False;
        unstring relname;
 
-       memcpy((char *)&force_new_election, userdata->data, sizeof(BOOL));
+       memcpy((char *)&force_new_election, userdata->data, sizeof(bool));
 
        DEBUG(3,("unbecome_local_master_success: released name %s.\n",
                nmb_namestr(released_name)));
@@ -165,10 +164,10 @@ static void unbecome_local_master_fail(struct subnet_record *subrec, struct resp
 {
        struct name_record *namerec;
        struct userdata_struct *userdata = rrec->userdata;
-       BOOL force_new_election = False;
+       bool force_new_election = False;
        unstring failname;
 
-       memcpy((char *)&force_new_election, userdata->data, sizeof(BOOL));
+       memcpy((char *)&force_new_election, userdata->data, sizeof(bool));
 
        DEBUG(0,("unbecome_local_master_fail: failed to release name %s. \
 Removing from namelist anyway.\n", nmb_namestr(fail_name)));
@@ -196,7 +195,7 @@ Removing from namelist anyway.\n", nmb_namestr(fail_name)));
 ******************************************************************/
 
 static void release_1d_name( struct subnet_record *subrec, const char *workgroup_name,
-                             BOOL force_new_election)
+                             bool force_new_election)
 {
        struct nmb_name nmbname;
        struct name_record *namerec;
@@ -204,17 +203,17 @@ static void release_1d_name( struct subnet_record *subrec, const char *workgroup
        make_nmb_name(&nmbname, workgroup_name, 0x1d);
        if((namerec = find_name_on_subnet( subrec, &nmbname, FIND_SELF_NAME))!=NULL) {
                struct userdata_struct *userdata;
-               size_t size = sizeof(struct userdata_struct) + sizeof(BOOL);
+               size_t size = sizeof(struct userdata_struct) + sizeof(bool);
 
-               if((userdata = (struct userdata_struct *)malloc(size)) == NULL) {
+               if((userdata = (struct userdata_struct *)SMB_MALLOC(size)) == NULL) {
                        DEBUG(0,("release_1d_name: malloc fail.\n"));
                        return;
                }
 
                userdata->copy_fn = NULL;
                userdata->free_fn = NULL;
-               userdata->userdata_len = sizeof(BOOL);
-               memcpy((char *)userdata->data, &force_new_election, sizeof(BOOL));
+               userdata->userdata_len = sizeof(bool);
+               memcpy((char *)userdata->data, &force_new_election, sizeof(bool));
 
                release_name(subrec, namerec,
                        unbecome_local_master_success,
@@ -269,7 +268,7 @@ static void release_msbrowse_name_fail( struct subnet_record *subrec,
 ******************************************************************/
 
 void unbecome_local_master_browser(struct subnet_record *subrec, struct work_record *work,
-                                   BOOL force_new_election)
+                                   bool force_new_election)
 {
        struct name_record *namerec;
        struct nmb_name nmbname;
@@ -545,7 +544,7 @@ in workgroup %s on subnet %s\n",
        subrec->work_changed = True;
 
        /* Setup the userdata_struct. */
-       if((userdata = (struct userdata_struct *)malloc(size)) == NULL) {
+       if((userdata = (struct userdata_struct *)SMB_MALLOC(size)) == NULL) {
                DEBUG(0,("become_local_master_browser: malloc fail.\n"));
                return;
        }