Mercurial > vim
comparison src/hardcopy.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 | f0f9692d4487 |
children | 7334bf933510 |
comparison
equal
deleted
inserted
replaced
20006:aee3c9266968 | 20007:aadd1cae2ff5 |
---|---|
556 prt_settings_T settings; | 556 prt_settings_T settings; |
557 long_u bytes_to_print = 0; | 557 long_u bytes_to_print = 0; |
558 int page_line; | 558 int page_line; |
559 int jobsplit; | 559 int jobsplit; |
560 | 560 |
561 vim_memset(&settings, 0, sizeof(prt_settings_T)); | 561 CLEAR_FIELD(settings); |
562 settings.has_color = TRUE; | 562 settings.has_color = TRUE; |
563 | 563 |
564 # ifdef FEAT_POSTSCRIPT | 564 # ifdef FEAT_POSTSCRIPT |
565 if (*eap->arg == '>') | 565 if (*eap->arg == '>') |
566 { | 566 { |
679 { | 679 { |
680 prt_pos_T prtpos; // current print position | 680 prt_pos_T prtpos; // current print position |
681 prt_pos_T page_prtpos; // print position at page start | 681 prt_pos_T page_prtpos; // print position at page start |
682 int side; | 682 int side; |
683 | 683 |
684 vim_memset(&page_prtpos, 0, sizeof(prt_pos_T)); | 684 CLEAR_FIELD(page_prtpos); |
685 page_prtpos.file_line = eap->line1; | 685 page_prtpos.file_line = eap->line1; |
686 prtpos = page_prtpos; | 686 prtpos = page_prtpos; |
687 | 687 |
688 if (jobsplit && collated_copies > 0) | 688 if (jobsplit && collated_copies > 0) |
689 { | 689 { |
1842 if (fd_resource == NULL) | 1842 if (fd_resource == NULL) |
1843 { | 1843 { |
1844 semsg(_("E624: Can't open file \"%s\""), resource->filename); | 1844 semsg(_("E624: Can't open file \"%s\""), resource->filename); |
1845 return FALSE; | 1845 return FALSE; |
1846 } | 1846 } |
1847 vim_memset(prt_resfile.buffer, NUL, PRT_FILE_BUFFER_LEN); | 1847 CLEAR_FIELD(prt_resfile.buffer); |
1848 | 1848 |
1849 // Parse first line to ensure valid resource file | 1849 // Parse first line to ensure valid resource file |
1850 prt_resfile.len = (int)fread((char *)prt_resfile.buffer, sizeof(char_u), | 1850 prt_resfile.len = (int)fread((char *)prt_resfile.buffer, sizeof(char_u), |
1851 PRT_FILE_BUFFER_LEN, fd_resource); | 1851 PRT_FILE_BUFFER_LEN, fd_resource); |
1852 if (ferror(fd_resource)) | 1852 if (ferror(fd_resource)) |