Can someone explain to me why the matchstar function takes its first param as an integer?
to me it should be a char.
int matchstar(int c, char *regexp, char *text)
{
do { /* a * matches zero or more instances */
if (matchhere(regexp, text))
return 1;
} while (*text != '\0' && (*text++ == c || c == '.'));
return 0;
}
It doesn't seem to make sense in this context. One hypothesis is that it could have been done out of habit to write safer code: whether char is signed or unsigned is left to the implementation, whereas int is guaranteed to be signed.