return 0;
}
+enum strtox_func {
+ strtox_func_strtol,
+ strtox_func_strtoul,
+};
+
#define EXPECT_STRTOX(cond, func, input, base, expected, chars, expected_errno) \
- do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strtox(llen, func, input, base, expected, chars, expected_errno); } while (0)
+ do { if (!(cond)) result(llen, SKIPPED); else ret += expect_strtox(llen, strtox_func_ ## func, input, base, expected, chars, expected_errno); } while (0)
static __attribute__((unused))
-int expect_strtox(int llen, void *func, const char *input, int base, intmax_t expected, int expected_chars, int expected_errno)
+int expect_strtox(int llen, enum strtox_func func, const char *input, int base, intmax_t expected, int expected_chars, int expected_errno)
{
char *endptr;
int actual_errno, actual_chars;
intmax_t r;
errno = 0;
- if (func == strtol) {
+ if (func == strtox_func_strtol) {
r = strtol(input, &endptr, base);
- } else if (func == strtoul) {
+ } else if (func == strtox_func_strtoul) {
r = strtoul(input, &endptr, base);
} else {
result(llen, FAIL);