0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-08-23 10:33:50 -04:00

outcoff: stylistic cleanups

Don't use explicit L's for things which are really size_t; not only is
it unnecessarily ugly, but it's wrong in a lot of ways.  Do some other
minor stylistic cleanups.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2008-09-02 12:56:39 -07:00
parent c00c897df7
commit fafb6a50e2

View File

@ -189,11 +189,11 @@ static void coff_gen_init(FILE * fp, efunc errfunc)
error = errfunc; error = errfunc;
sects = NULL; sects = NULL;
nsects = sectlen = 0; nsects = sectlen = 0;
syms = saa_init((int32_t)sizeof(struct Symbol)); syms = saa_init(sizeof(struct Symbol));
nsyms = 0; nsyms = 0;
bsym = raa_init(); bsym = raa_init();
symval = raa_init(); symval = raa_init();
strs = saa_init(1L); strs = saa_init(1);
strslen = 0; strslen = 0;
def_seg = seg_alloc(); def_seg = seg_alloc();
} }
@ -231,7 +231,7 @@ static int coff_make_section(char *name, uint32_t flags)
s = nasm_malloc(sizeof(*s)); s = nasm_malloc(sizeof(*s));
if (flags != BSS_FLAGS) if (flags != BSS_FLAGS)
s->data = saa_init(1L); s->data = saa_init(1);
else else
s->data = NULL; s->data = NULL;
s->head = NULL; s->head = NULL;
@ -246,9 +246,10 @@ static int coff_make_section(char *name, uint32_t flags)
s->name[8] = '\0'; s->name[8] = '\0';
s->flags = flags; s->flags = flags;
if (nsects >= sectlen) if (nsects >= sectlen) {
sects = sectlen += SECT_DELTA;
nasm_realloc(sects, (sectlen += SECT_DELTA) * sizeof(*sects)); sects = nasm_realloc(sects, sectlen * sizeof(*sects));
}
sects[nsects++] = s; sects[nsects++] = s;
return nsects - 1; return nsects - 1;
@ -398,8 +399,9 @@ static void coff_deflabel(char *name, int32_t segment, int64_t offset,
} }
if (strlen(name) > 8) { if (strlen(name) > 8) {
saa_wbytes(strs, name, (int32_t)(1 + strlen(name))); size_t nlen = strlen(name)+1;
strslen += 1 + strlen(name); saa_wbytes(strs, name, nlen);
strslen += nlen;
} else } else
pos = -1; pos = -1;
@ -895,7 +897,7 @@ static void coff_symbol(char *name, int32_t strpos, int32_t value,
strncpy(padname, name, 8); strncpy(padname, name, 8);
fwrite(padname, 8, 1, coffp); fwrite(padname, 8, 1, coffp);
} else { } else {
fwriteint32_t(0L, coffp); fwriteint32_t(0, coffp);
fwriteint32_t(strpos, coffp); fwriteint32_t(strpos, coffp);
} }
fwriteint32_t(value, coffp); fwriteint32_t(value, coffp);