mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Some refactoring
This commit is contained in:
@@ -11,34 +11,33 @@
|
||||
|
||||
static void vwarn(char const NONNULL(fmt), va_list ap)
|
||||
{
|
||||
const char *error = strerror(errno);
|
||||
|
||||
fprintf(stderr, "warning: ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fputs(": ", stderr);
|
||||
perror(NULL);
|
||||
fprintf(stderr, ": %s\n", error);
|
||||
}
|
||||
|
||||
static void vwarnx(char const NONNULL(fmt), va_list ap)
|
||||
{
|
||||
fprintf(stderr, "warning");
|
||||
fputs(": ", stderr);
|
||||
fprintf(stderr, "warning: ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
putc('\n', stderr);
|
||||
}
|
||||
|
||||
[[noreturn]] static void verr(char const NONNULL(fmt), va_list ap)
|
||||
{
|
||||
const char *error = strerror(errno);
|
||||
|
||||
fprintf(stderr, "error: ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fputs(": ", stderr);
|
||||
fputs(strerror(errno), stderr);
|
||||
putc('\n', stderr);
|
||||
fprintf(stderr, ": %s\n", error);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
[[noreturn]] static void verrx(char const NONNULL(fmt), va_list ap)
|
||||
{
|
||||
fprintf(stderr, "error");
|
||||
fputs(": ", stderr);
|
||||
fprintf(stderr, "error: ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
putc('\n', stderr);
|
||||
exit(1);
|
||||
|
||||
@@ -297,22 +297,19 @@ static void placeSection(struct Section *section)
|
||||
|
||||
if (section->isBankFixed && nbbanks(section->type) != 1) {
|
||||
if (section->isAddressFixed)
|
||||
snprintf(where, 64, "at $%02" PRIx32 ":%04" PRIx16,
|
||||
snprintf(where, sizeof(where), "at $%02" PRIx32 ":%04" PRIx16,
|
||||
section->bank, section->org);
|
||||
else if (section->isAlignFixed)
|
||||
snprintf(where, 64, "in bank $%02" PRIx32 " with align mask %" PRIx16,
|
||||
snprintf(where, sizeof(where), "in bank $%02" PRIx32 " with align mask %" PRIx16,
|
||||
section->bank, (uint16_t)~section->alignMask);
|
||||
else
|
||||
snprintf(where, 64, "in bank $%02" PRIx32,
|
||||
section->bank);
|
||||
snprintf(where, sizeof(where), "in bank $%02" PRIx32, section->bank);
|
||||
} else {
|
||||
if (section->isAddressFixed)
|
||||
snprintf(where, 64, "at address $%04" PRIx16,
|
||||
section->org);
|
||||
snprintf(where, sizeof(where), "at address $%04" PRIx16, section->org);
|
||||
else if (section->isAlignFixed)
|
||||
snprintf(where, 64, "with align mask %" PRIx16 " and offset %" PRIx16,
|
||||
(uint16_t)~section->alignMask,
|
||||
section->alignOfs);
|
||||
snprintf(where, sizeof(where), "with align mask %" PRIx16 " and offset %" PRIx16,
|
||||
(uint16_t)~section->alignMask, section->alignOfs);
|
||||
else
|
||||
strcpy(where, "anywhere");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user