some cleanups to use ZERO_STRUCT() and friends
authorAndrew Tridgell <tridge@samba.org>
Sat, 5 Sep 1998 13:24:20 +0000 (13:24 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 5 Sep 1998 13:24:20 +0000 (13:24 +0000)
(This used to be commit 7b154dc4313324dfad6cf0117b8ce246bf12bf16)

13 files changed:
source3/auth/pass_check.c
source3/lib/signal.c
source3/lib/util_hnd.c
source3/passdb/pass_check.c
source3/printing/print_svid.c
source3/rpc_client/cli_netlogon.c
source3/rpc_server/srv_lsa_hnd.c
source3/rpc_server/srv_pipe_hnd.c
source3/smbd/conn.c
source3/smbd/filename.c
source3/smbd/files.c
source3/smbd/password.c
source3/utils/smbpasswd.c

index 9005864b08c21828af4626097b43dfe4f5d3a043..edb4c9729049421e3cbd1eb060c638164a29658f 100644 (file)
@@ -506,7 +506,7 @@ static BOOL krb5_auth(char *user,char *password)
                return(False);
        }
 
-       memset((char *)&kcreds, 0, sizeof(kcreds));
+       ZERO_STRUCT(kcreds);
 
        kcreds.client = kprinc;
        
index db72b458a7a850ae964b8c9442e2d6e6ae868c1d..bb1c6fe189b5d98ea3d9bb554b16b6370593b494 100644 (file)
@@ -76,7 +76,7 @@ void CatchSignal(int signum,void (*handler)(int ))
 #ifdef HAVE_SIGACTION
        struct sigaction act;
 
-       memset(&act, 0, sizeof(act));
+       ZERO_STRUCT(act);
 
        act.sa_handler = handler;
 #ifdef SA_RESTART
index addedaec903a342c989e9224d6d77b32465da4a9..b1e695360f735e2976e050497b52a69f928364d0 100644 (file)
@@ -114,7 +114,7 @@ BOOL open_lsa_policy_hnd(POLICY_HND *hnd)
                return False;
        }
 
-       memset(p, 0, sizeof(*p));
+       ZERO_STRUCTP(p);
 
        p->open = True;                         
        p->pnum = i;
@@ -280,7 +280,7 @@ BOOL close_lsa_policy_hnd(POLICY_HND *hnd)
 
        bitmap_clear(bmap, p->pnum);
 
-       memset(p, 0, sizeof(*p));
+       ZERO_STRUCTP(p);
 
        free(p);
 
index 9005864b08c21828af4626097b43dfe4f5d3a043..edb4c9729049421e3cbd1eb060c638164a29658f 100644 (file)
@@ -506,7 +506,7 @@ static BOOL krb5_auth(char *user,char *password)
                return(False);
        }
 
-       memset((char *)&kcreds, 0, sizeof(kcreds));
+       ZERO_STRUCT(kcreds);
 
        kcreds.client = kprinc;
        
index f2126f25acde5f363edb2003d12436f020f35283..1f9f75a4fa7f6441465c67160ab96dec449c1d28 100644 (file)
@@ -68,7 +68,7 @@ static void populate_printers(void)
 
                        /* add it to the cache */
                        if ((ptmp = malloc(sizeof (*ptmp))) != NULL) {
-                               memset(ptmp, '\0', sizeof (*ptmp));
+                               ZERO_STRUCTP(ptmp);
                                ptmp->name = strdup(name);
                                ptmp->next = printers;
                                printers = ptmp;
index 9d1fde50c03a159d3511aef0ee418d97eae0d732..757c5166e884ae988d8cf775ee1d555312a01b24 100644 (file)
@@ -477,7 +477,7 @@ static BOOL modify_trust_password( char *domain, char *remote_machine,
   struct in_addr dest_ip;
   struct cli_state cli;
 
-  memset(&cli, '\0', sizeof(struct cli_state));
+  ZERO_STRUCT(cli);
   if(cli_initialise(&cli) == False) {
     DEBUG(0,("modify_trust_password: unable to initialize client connection.\n"));
     return False;
index addedaec903a342c989e9224d6d77b32465da4a9..b1e695360f735e2976e050497b52a69f928364d0 100644 (file)
@@ -114,7 +114,7 @@ BOOL open_lsa_policy_hnd(POLICY_HND *hnd)
                return False;
        }
 
-       memset(p, 0, sizeof(*p));
+       ZERO_STRUCTP(p);
 
        p->open = True;                         
        p->pnum = i;
@@ -280,7 +280,7 @@ BOOL close_lsa_policy_hnd(POLICY_HND *hnd)
 
        bitmap_clear(bmap, p->pnum);
 
-       memset(p, 0, sizeof(*p));
+       ZERO_STRUCTP(p);
 
        free(p);
 
index 54b9ce1539386db81d8f01579234f62cf7f77d61..3b743188a3e939d603fb45d696d88352e7c534b5 100644 (file)
@@ -98,7 +98,7 @@ pipes_struct *open_rpc_pipe_p(char *pipe_name,
 
        pipes_open++;
 
-       memset(p, 0, sizeof(*p));
+       ZERO_STRUCTP(p);
        p->pnum = i;
 
        p->open = True;
@@ -278,7 +278,7 @@ BOOL close_rpc_pipe_hnd(pipes_struct *p, connection_struct *conn)
 
        DLIST_REMOVE(Pipes, p);
 
-       memset(p, 0, sizeof(*p));
+       ZERO_STRUCTP(p);
 
        free(p);
        
index 2afbfb7d7ebf848077cc53a84a830345d6492ff9..5dc904bd91bd96e8aae784c564d07a7954100c52 100644 (file)
@@ -108,7 +108,7 @@ connection_struct *conn_new(void)
        conn = (connection_struct *)malloc(sizeof(*conn));
        if (!conn) return NULL;
 
-       memset(conn, 0, sizeof(*conn));
+       ZERO_STRUCTP(conn);
        conn->cnum = i;
 
        bitmap_set(bmap, i);
@@ -184,6 +184,6 @@ void conn_free(connection_struct *conn)
        bitmap_clear(bmap, conn->cnum);
        num_open--;
 
-       memset(conn, 0, sizeof(*conn));
+       ZERO_STRUCTP(conn);
        free(conn);
 }
index 115ff699c7db9cf6f9d5608027ca9582012ee080..8b81d6df2a0d6ef243a97a018410eea3b5ac1124 100644 (file)
@@ -334,8 +334,9 @@ BOOL unix_convert(char *name,connection_struct *conn,char *saved_last_component,
 
   *dirpath = 0;
   *bad_path = False;
-  if(pst)
-    memset( (char *)pst, '\0', sizeof(SMB_STRUCT_STAT));
+  if(pst) {
+         ZERO_STRUCTP(pst);
+  }
 
   if(saved_last_component)
     *saved_last_component = 0;
index 0fe6a4ebd1bb55b09cd9f92fcc564ef8e9cf9607..ed14b86e5fefbd5709479c7924ba8c99baf52f79 100644 (file)
@@ -91,7 +91,7 @@ files_struct *file_new(void )
        fsp = (files_struct *)malloc(sizeof(*fsp));
        if (!fsp) return NULL;
 
-       memset(fsp, 0, sizeof(*fsp));
+       ZERO_STRUCTP(fsp);
 
        first_file = (i+1) % MAX_FNUMS;
 
@@ -166,7 +166,7 @@ file_fd_struct *fd_get_new(void)
        fd_ptr = (file_fd_struct *)malloc(sizeof(*fd_ptr));
        if (!fd_ptr) return NULL;
        
-       memset(fd_ptr, 0, sizeof(*fd_ptr));
+       ZERO_STRUCTP(fd_ptr);
        
        fd_ptr->fdnum = i;
        fd_ptr->dev = (SMB_DEV_T)-1;
@@ -327,7 +327,7 @@ void fd_ptr_free(file_fd_struct *fd_ptr)
                 fd_ptr->fdnum, fd_ptr_used));
 
        /* paranoia */
-       memset(fd_ptr, 0, sizeof(*fd_ptr));
+       ZERO_STRUCTP(fd_ptr);
 
        free(fd_ptr);
 }
@@ -354,7 +354,7 @@ void file_free(files_struct *fsp)
 
        /* this is paranoia, just in case someone tries to reuse the 
           information */
-       memset(fsp, 0, sizeof(*fsp));
+       ZERO_STRUCTP(fsp);
 
        if (fsp == chain_fsp) chain_fsp = NULL;
 
index 684420f4c320cc5dc0e3bd2cb839efd7be26c75d..1d90af3066c9d4741b10cf9bcd414de8af062b92 100644 (file)
@@ -1202,7 +1202,8 @@ machine %s in domain %s.\n", global_myname, global_myworkgroup ));
    * see if they were valid.
    */
 
-  memset(&cli, '\0', sizeof(struct cli_state));
+  ZERO_STRUCT(cli);
+
   if(cli_initialise(&cli) == False) {
     DEBUG(0,("domain_client_validate: unable to initialize client connection.\n"));
     return False;
index f9b95062976a27925f4ad04c0f4909cf6268790d..03553b0ea964ea3067661056e4a8864271771592 100644 (file)
@@ -430,7 +430,7 @@ int main(int argc, char **argv)
       exit(1);
     }
  
-    memset(&cli, '\0', sizeof(struct cli_state));
+    ZERO_STRUCT(cli);
  
     if (!cli_initialise(&cli) || !cli_connect(&cli, remote_machine, &ip)) {
       fprintf(stderr, "%s: unable to connect to SMB server on machine %s. Error was : %s.\n",