From f6044c87c021342d68d614d59bc8dacd32d223b9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 Sep 1998 13:24:20 +0000 Subject: some cleanups to use ZERO_STRUCT() and friends (This used to be commit 7b154dc4313324dfad6cf0117b8ce246bf12bf16) --- source3/smbd/conn.c | 4 ++-- source3/smbd/filename.c | 5 +++-- source3/smbd/files.c | 8 ++++---- source3/smbd/password.c | 3 ++- 4 files changed, 11 insertions(+), 9 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index 2afbfb7d7e..5dc904bd91 100644 --- a/source3/smbd/conn.c +++ b/source3/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/source3/smbd/filename.c b/source3/smbd/filename.c index 115ff699c7..8b81d6df2a 100644 --- a/source3/smbd/filename.c +++ b/source3/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/source3/smbd/files.c b/source3/smbd/files.c index 0fe6a4ebd1..ed14b86e5f 100644 --- a/source3/smbd/files.c +++ b/source3/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/source3/smbd/password.c b/source3/smbd/password.c index 684420f4c3..1d90af3066 100644 --- a/source3/smbd/password.c +++ b/source3/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; -- cgit