summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-09-05 13:24:20 +0000
committerAndrew Tridgell <tridge@samba.org>1998-09-05 13:24:20 +0000
commit7b154dc4313324dfad6cf0117b8ce246bf12bf16 (patch)
tree16189315a5407b7be2c7cbc7e5c282aa89d8ce83
parentead0338ad27f29f1abbbe9f6302d6bf633bf98b2 (diff)
downloadsamba-7b154dc4313324dfad6cf0117b8ce246bf12bf16.tar.gz
some cleanups to use ZERO_STRUCT() and friends
-rw-r--r--source/auth/pass_check.c2
-rw-r--r--source/lib/signal.c2
-rw-r--r--source/lib/util_hnd.c4
-rw-r--r--source/passdb/pass_check.c2
-rw-r--r--source/printing/print_svid.c2
-rw-r--r--source/rpc_client/cli_netlogon.c2
-rw-r--r--source/rpc_server/srv_lsa_hnd.c4
-rw-r--r--source/rpc_server/srv_pipe_hnd.c4
-rw-r--r--source/smbd/conn.c4
-rw-r--r--source/smbd/filename.c5
-rw-r--r--source/smbd/files.c8
-rw-r--r--source/smbd/password.c3
-rw-r--r--source/utils/smbpasswd.c2
13 files changed, 23 insertions, 21 deletions
diff --git a/source/auth/pass_check.c b/source/auth/pass_check.c
index 9005864b08c..edb4c972904 100644
--- a/source/auth/pass_check.c
+++ b/source/auth/pass_check.c
@@ -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;
diff --git a/source/lib/signal.c b/source/lib/signal.c
index db72b458a7a..bb1c6fe189b 100644
--- a/source/lib/signal.c
+++ b/source/lib/signal.c
@@ -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
diff --git a/source/lib/util_hnd.c b/source/lib/util_hnd.c
index addedaec903..b1e695360f7 100644
--- a/source/lib/util_hnd.c
+++ b/source/lib/util_hnd.c
@@ -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);
diff --git a/source/passdb/pass_check.c b/source/passdb/pass_check.c
index 9005864b08c..edb4c972904 100644
--- a/source/passdb/pass_check.c
+++ b/source/passdb/pass_check.c
@@ -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;
diff --git a/source/printing/print_svid.c b/source/printing/print_svid.c
index f2126f25acd..1f9f75a4fa7 100644
--- a/source/printing/print_svid.c
+++ b/source/printing/print_svid.c
@@ -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;
diff --git a/source/rpc_client/cli_netlogon.c b/source/rpc_client/cli_netlogon.c
index 9d1fde50c03..757c5166e88 100644
--- a/source/rpc_client/cli_netlogon.c
+++ b/source/rpc_client/cli_netlogon.c
@@ -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;
diff --git a/source/rpc_server/srv_lsa_hnd.c b/source/rpc_server/srv_lsa_hnd.c
index addedaec903..b1e695360f7 100644
--- a/source/rpc_server/srv_lsa_hnd.c
+++ b/source/rpc_server/srv_lsa_hnd.c
@@ -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);
diff --git a/source/rpc_server/srv_pipe_hnd.c b/source/rpc_server/srv_pipe_hnd.c
index 54b9ce15393..3b743188a3e 100644
--- a/source/rpc_server/srv_pipe_hnd.c
+++ b/source/rpc_server/srv_pipe_hnd.c
@@ -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);
diff --git a/source/smbd/conn.c b/source/smbd/conn.c
index 2afbfb7d7eb..5dc904bd91b 100644
--- a/source/smbd/conn.c
+++ b/source/smbd/conn.c
@@ -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);
}
diff --git a/source/smbd/filename.c b/source/smbd/filename.c
index 115ff699c7d..8b81d6df2a0 100644
--- a/source/smbd/filename.c
+++ b/source/smbd/filename.c
@@ -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;
diff --git a/source/smbd/files.c b/source/smbd/files.c
index 0fe6a4ebd1b..ed14b86e5fe 100644
--- a/source/smbd/files.c
+++ b/source/smbd/files.c
@@ -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;
diff --git a/source/smbd/password.c b/source/smbd/password.c
index 684420f4c32..1d90af3066c 100644
--- a/source/smbd/password.c
+++ b/source/smbd/password.c
@@ -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;
diff --git a/source/utils/smbpasswd.c b/source/utils/smbpasswd.c
index f9b95062976..03553b0ea96 100644
--- a/source/utils/smbpasswd.c
+++ b/source/utils/smbpasswd.c
@@ -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",