summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-02-21 17:27:51 -0800
committerH. Peter Anvin <hpa@zytor.com>2009-02-21 17:27:51 -0800
commit577f57614a159e3c5ab10bf03d345846796de932 (patch)
tree8ce5f15f177b9b58a7f52a17118acca269b38876
parenta5c2455f8aacfc50863c4d3dfd9782c9c3b392e8 (diff)
downloadnasm-577f57614a159e3c5ab10bf03d345846796de932.tar.gz
outelf32/64: remove align_str in favor of fwritezero()
Drop the use of yet another local all-zero buffer, align_str, in favor of calling fwritezero().
-rw-r--r--output/outelf32.c6
-rw-r--r--output/outelf64.c6
2 files changed, 4 insertions, 8 deletions
diff --git a/output/outelf32.c b/output/outelf32.c
index 024b209d..604c353a 100644
--- a/output/outelf32.c
+++ b/output/outelf32.c
@@ -175,8 +175,6 @@ extern struct ofmt of_elf;
#define SOC(ln,aa) ln - line_base + (line_range * aa) + opcode_base
-static const char align_str[SEG_ALIGN] = ""; /* ANSI will pad this with 0s */
-
static struct ELF_SECTDATA {
void *data;
int32_t len;
@@ -1233,7 +1231,7 @@ static void elf_write(void)
loclen, 0, 0, 1, 0);
}
- fwrite(align_str, align, 1, elffp);
+ fwritezero(align, elffp);
/*
* Now output the sections.
@@ -1434,7 +1432,7 @@ static void elf_write_sections(void)
saa_fpwrite(elf_sects[i].data, elffp);
else
fwrite(elf_sects[i].data, len, 1, elffp);
- fwrite(align_str, align, 1, elffp);
+ fwritezero(align, elffp);
}
}
diff --git a/output/outelf64.c b/output/outelf64.c
index 9960a394..24d0b81c 100644
--- a/output/outelf64.c
+++ b/output/outelf64.c
@@ -215,8 +215,6 @@ extern struct ofmt of_elf64;
#define TY_DEBUGSYMLIN 0x40 /* internal call to debug_out */
-static const char align_str[SEG_ALIGN] = ""; /* ANSI will pad this with 0s */
-
static struct ELF_SECTDATA {
void *data;
int64_t len;
@@ -1349,7 +1347,7 @@ static void elf_write(void)
loclen, 0, 0, 1, 0);
}
- fwrite(align_str, align, 1, elffp);
+ fwritezero(align, elffp);
/*
* Now output the sections.
@@ -1550,7 +1548,7 @@ static void elf_write_sections(void)
saa_fpwrite(elf_sects[i].data, elffp);
else
fwrite(elf_sects[i].data, len, 1, elffp);
- fwrite(align_str, align, 1, elffp);
+ fwritezero(align, elffp);
}
}