debug: remove some parentheses

This commit is contained in:
snow flurry 2020-11-16 19:42:27 -08:00
parent c35c6f0389
commit e7b8a47e49
2 changed files with 12 additions and 12 deletions

View file

@ -2,7 +2,7 @@
#define _DEBUG_H #define _DEBUG_H
#ifdef DEBUG #ifdef DEBUG
#define DPRINTF(x) printf(x) #define DPRINTF(x) printf x
#else #else
#define DPRINTF(x) #define DPRINTF(x)
#endif #endif

View file

@ -35,13 +35,13 @@ open_image(const char *path, int flags, dosfs_t *fsd)
} }
if (fsd->ib.jmp[0] != 0xEB || fsd->ib.jmp[2] != 0x90) { if (fsd->ib.jmp[0] != 0xEB || fsd->ib.jmp[2] != 0x90) {
DPRINTF("hm... doesn't look like a FAT image?\n"); DPRINTF(("hm... doesn't look like a FAT image?\n"));
close(ifd); close(ifd);
return EOPNOTSUPP; return EOPNOTSUPP;
} }
if (fsd->ib.sect_ct == 0 || fsd->ib.fat_size == 0) { if (fsd->ib.sect_ct == 0 || fsd->ib.fat_size == 0) {
DPRINTF("sect_ct or fat_size == 0, likely fat>32 (unsupported)\n"); DPRINTF(("sect_ct or fat_size == 0, likely fat>32 (unsupported)\n"));
close(ifd); close(ifd);
return EOPNOTSUPP; return EOPNOTSUPP;
} }
@ -57,7 +57,7 @@ open_image(const char *path, int flags, dosfs_t *fsd)
} else if (fsd->data_size < FAT16_MAX_CLUSTERS) { } else if (fsd->data_size < FAT16_MAX_CLUSTERS) {
fsd->fs_ver = 16; fsd->fs_ver = 16;
} else { } else {
DPRINTF("data_size >= FAT12_MAX_CLUSTERS, likely fat>32 (unsupported)\n"); DPRINTF(("data_size >= FAT12_MAX_CLUSTERS, likely fat>32 (unsupported)\n"));
close(ifd); close(ifd);
return EOPNOTSUPP; return EOPNOTSUPP;
} }
@ -93,7 +93,7 @@ dos_listdir(dosfs_t *fsd, unsigned int offset)
start = malloc(sizeof(dosfile_t)); start = malloc(sizeof(dosfile_t));
if (start == NULL) { if (start == NULL) {
DPRINTF("malloc failed\n"); DPRINTF(("malloc failed\n"));
return NULL; return NULL;
} }
@ -107,14 +107,14 @@ dos_listdir(dosfs_t *fsd, unsigned int offset)
res = reallocarr(&dirs, root_ents, sizeof(struct dos_dirent)); res = reallocarr(&dirs, root_ents, sizeof(struct dos_dirent));
if (res == -1) { if (res == -1) {
DPRINTF("reallocarr failed\n"); DPRINTF(("reallocarr failed\n"));
return NULL; return NULL;
} }
res = pread(fsd->ifd, dirs, (root_ents * sizeof(struct dos_dirent)), res = pread(fsd->ifd, dirs, (root_ents * sizeof(struct dos_dirent)),
offset); offset);
if (res == -1) { if (res == -1) {
DPRINTF("pread failed\n"); DPRINTF(("pread failed\n"));
return NULL; return NULL;
} }
@ -128,7 +128,7 @@ dos_listdir(dosfs_t *fsd, unsigned int offset)
if (i > 0) { if (i > 0) {
cur->next = malloc(sizeof(dosfile_t)); cur->next = malloc(sizeof(dosfile_t));
if (cur->next == NULL) { if (cur->next == NULL) {
DPRINTF("inner malloc failed!?\n"); DPRINTF(("inner malloc failed!?\n"));
res = -1; res = -1;
break; break;
} }
@ -199,7 +199,7 @@ read_fat_chain(dosfs_t *fsd, unsigned int first, int *length)
len++; len++;
res = reallocarr(&chain, len, sizeof(unsigned int)); res = reallocarr(&chain, len, sizeof(unsigned int));
if (res == -1) { if (res == -1) {
DPRINTF("reallocarr failed\n"); DPRINTF(("reallocarr failed\n"));
free(chain); free(chain);
return NULL; return NULL;
} }
@ -211,7 +211,7 @@ read_fat_chain(dosfs_t *fsd, unsigned int first, int *length)
/* XXX: endianness */ /* XXX: endianness */
res = pread(fsd->ifd, &next, 2, byte_off); res = pread(fsd->ifd, &next, 2, byte_off);
if (res == -1) { if (res == -1) {
DPRINTF("pread failed\n"); DPRINTF(("pread failed\n"));
free(chain); free(chain);
return NULL; return NULL;
} }
@ -248,7 +248,7 @@ get_byte_offset(dosfs_t *fsd, dosfile_t *file, int f_offset)
int coff, csz; int coff, csz;
if (f_offset > file->ent.size) { if (f_offset > file->ent.size) {
DPRINTF("offset requested is out of bounds!\n"); DPRINTF(("offset requested is out of bounds!\n"));
return -EINVAL; return -EINVAL;
} }
@ -259,7 +259,7 @@ get_byte_offset(dosfs_t *fsd, dosfile_t *file, int f_offset)
coff = f_offset / csz; coff = f_offset / csz;
if (coff > file->fc_len) { if (coff > file->fc_len) {
DPRINTF("offset is within filesize, but not enough clusters??\n"); DPRINTF(("offset is within filesize, but not enough clusters??\n"));
return -EINVAL; return -EINVAL;
} }