diff options
-rw-r--r-- | test_gen.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -122,16 +122,11 @@ static void unpack_unsigned(FILE *out, const struct fmtinfo *fi, enum endian e, fprintf(out, "\tCHECK_EQUAL(PRIdMAX, (uintmax_t)v[%d], UINTMAX_C(%" PRIuMAX "));\n", i, testval); } -static void unpack_gen(FILE *out, size_t fmt, int arraysize) +static void unpack_gen(FILE *out, const struct fmtinfo *fi, int arraysize) { int realsize = arraysize == 0 ? 1 : arraysize; - struct fmtinfo *fi; bool sign; - assert(fmt < sizeof fmtinfo / sizeof fmtinfo[0]); - - fi = &fmtinfo[fmt]; - sign = islower(fi->fmt); fprintf(out, "TEST(unpack_simple%d_%s, \"unpack simple", arraysize, cname(fi->type)); @@ -157,9 +152,9 @@ static void unpack_gen(FILE *out, size_t fmt, int arraysize) int main(void) { FILE *out = stdout; - for (size_t fmt = 0; fmt < sizeof fmtinfo / sizeof fmtinfo[0]; fmt++) { - unpack_gen(out, fmt, 0); - for (int i = 2; i < 4; i++) - unpack_gen(out, fmt, i); + for (size_t i = 0; i < sizeof fmtinfo / sizeof fmtinfo[0]; i++) { + unpack_gen(out, &fmtinfo[i], 0); + for (int j = 2; j < 4; j++) + unpack_gen(out, &fmtinfo[i], j); } } |