Remove unnecessary calls to memset

The C standard guarantees that strncpy pads
the string with zeros if source string is smaller
than destination buffer.

Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Philipp Kloke 2013-03-31 11:59:22 +02:00 committed by Cyrill Gorcunov
parent 94ba02fa16
commit c51a224ceb

View File

@ -945,7 +945,6 @@ static void coff_section_header(char *name, int32_t vsize,
(void)vsize;
memset(padname, 0, 8);
strncpy(padname, name, 8);
fwrite(padname, 8, 1, ofile);
@ -998,7 +997,6 @@ static void coff_symbol(char *name, int32_t strpos, int32_t value,
char padname[8];
if (name) {
memset(padname, 0, 8);
strncpy(padname, name, 8);
fwrite(padname, 8, 1, ofile);
} else {
@ -1023,7 +1021,6 @@ static void coff_write_symbols(void)
* The `.file' record, and the file name auxiliary record.
*/
coff_symbol(".file", 0L, 0L, -2, 0, 0x67, 1);
memset(filename, 0, 18);
strncpy(filename, coff_infile, 18);
fwrite(filename, 18, 1, ofile);