diff src/channel.c @ 20007:aadd1cae2ff5 v8.2.0559

patch 8.2.0559: clearing a struct is verbose Commit: https://github.com/vim/vim/commit/a80faa8930ed5a554beeb2727762538873135e83 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 12 19:37:17 2020 +0200 patch 8.2.0559: clearing a struct is verbose Problem: Clearing a struct is verbose. Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER().
author Bram Moolenaar <Bram@vim.org>
date Sun, 12 Apr 2020 19:45:05 +0200
parents e373843e2980
children 128963cd954f
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -977,7 +977,7 @@ channel_open(
     // Get the server internet address and put into addr structure fill in the
     // socket address structure and connect to server.
 #ifdef FEAT_IPV6
-    vim_memset(&hints, 0, sizeof(hints));
+    CLEAR_FIELD(hints);
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_STREAM;
 # ifdef AI_ADDRCONFIG
@@ -1037,7 +1037,7 @@ channel_open(
 
     freeaddrinfo(res);
 #else
-    vim_memset((char *)&server, 0, sizeof(server));
+    CLEAR_FIELD(server);
     server.sin_family = AF_INET;
     server.sin_port = htons(port);
     if ((host = gethostbyname(hostname)) == NULL)
@@ -2514,7 +2514,7 @@ channel_exe_cmd(channel_T *channel, ch_p
 	exarg_T ea;
 
 	ch_log(channel, "Executing normal command '%s'", (char *)arg);
-	vim_memset(&ea, 0, sizeof(ea));
+	CLEAR_FIELD(ea);
 	ea.arg = arg;
 	ea.addr_count = 0;
 	ea.forceit = TRUE; // no mapping
@@ -2525,7 +2525,7 @@ channel_exe_cmd(channel_T *channel, ch_p
 	exarg_T ea;
 
 	ch_log(channel, "redraw");
-	vim_memset(&ea, 0, sizeof(ea));
+	CLEAR_FIELD(ea);
 	ea.forceit = *arg != NUL;
 	ex_redraw(&ea);
 	showruler(FALSE);
@@ -4793,7 +4793,7 @@ handle_io(typval_T *item, ch_part_T part
     void
 clear_job_options(jobopt_T *opt)
 {
-    vim_memset(opt, 0, sizeof(jobopt_T));
+    CLEAR_POINTER(opt);
 }
 
 /*