comparison 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
comparison
equal deleted inserted replaced
20006:aee3c9266968 20007:aadd1cae2ff5
975 } 975 }
976 976
977 // Get the server internet address and put into addr structure fill in the 977 // Get the server internet address and put into addr structure fill in the
978 // socket address structure and connect to server. 978 // socket address structure and connect to server.
979 #ifdef FEAT_IPV6 979 #ifdef FEAT_IPV6
980 vim_memset(&hints, 0, sizeof(hints)); 980 CLEAR_FIELD(hints);
981 hints.ai_family = AF_UNSPEC; 981 hints.ai_family = AF_UNSPEC;
982 hints.ai_socktype = SOCK_STREAM; 982 hints.ai_socktype = SOCK_STREAM;
983 # ifdef AI_ADDRCONFIG 983 # ifdef AI_ADDRCONFIG
984 hints.ai_flags = AI_ADDRCONFIG; 984 hints.ai_flags = AI_ADDRCONFIG;
985 # endif 985 # endif
1035 break; 1035 break;
1036 } 1036 }
1037 1037
1038 freeaddrinfo(res); 1038 freeaddrinfo(res);
1039 #else 1039 #else
1040 vim_memset((char *)&server, 0, sizeof(server)); 1040 CLEAR_FIELD(server);
1041 server.sin_family = AF_INET; 1041 server.sin_family = AF_INET;
1042 server.sin_port = htons(port); 1042 server.sin_port = htons(port);
1043 if ((host = gethostbyname(hostname)) == NULL) 1043 if ((host = gethostbyname(hostname)) == NULL)
1044 { 1044 {
1045 ch_error(channel, "in gethostbyname() in channel_open()"); 1045 ch_error(channel, "in gethostbyname() in channel_open()");
2512 else if (STRCMP(cmd, "normal") == 0) 2512 else if (STRCMP(cmd, "normal") == 0)
2513 { 2513 {
2514 exarg_T ea; 2514 exarg_T ea;
2515 2515
2516 ch_log(channel, "Executing normal command '%s'", (char *)arg); 2516 ch_log(channel, "Executing normal command '%s'", (char *)arg);
2517 vim_memset(&ea, 0, sizeof(ea)); 2517 CLEAR_FIELD(ea);
2518 ea.arg = arg; 2518 ea.arg = arg;
2519 ea.addr_count = 0; 2519 ea.addr_count = 0;
2520 ea.forceit = TRUE; // no mapping 2520 ea.forceit = TRUE; // no mapping
2521 ex_normal(&ea); 2521 ex_normal(&ea);
2522 } 2522 }
2523 else if (STRCMP(cmd, "redraw") == 0) 2523 else if (STRCMP(cmd, "redraw") == 0)
2524 { 2524 {
2525 exarg_T ea; 2525 exarg_T ea;
2526 2526
2527 ch_log(channel, "redraw"); 2527 ch_log(channel, "redraw");
2528 vim_memset(&ea, 0, sizeof(ea)); 2528 CLEAR_FIELD(ea);
2529 ea.forceit = *arg != NUL; 2529 ea.forceit = *arg != NUL;
2530 ex_redraw(&ea); 2530 ex_redraw(&ea);
2531 showruler(FALSE); 2531 showruler(FALSE);
2532 setcursor(); 2532 setcursor();
2533 out_flush_cursor(TRUE, FALSE); 2533 out_flush_cursor(TRUE, FALSE);
4791 * Clear a jobopt_T before using it. 4791 * Clear a jobopt_T before using it.
4792 */ 4792 */
4793 void 4793 void
4794 clear_job_options(jobopt_T *opt) 4794 clear_job_options(jobopt_T *opt)
4795 { 4795 {
4796 vim_memset(opt, 0, sizeof(jobopt_T)); 4796 CLEAR_POINTER(opt);
4797 } 4797 }
4798 4798
4799 /* 4799 /*
4800 * Free any members of a jobopt_T. 4800 * Free any members of a jobopt_T.
4801 */ 4801 */