Skip to content

Instantly share code, notes, and snippets.

@vibhavp
Created March 27, 2015 18:40
Show Gist options
  • Save vibhavp/976cec43740626206ccf to your computer and use it in GitHub Desktop.
Save vibhavp/976cec43740626206ccf to your computer and use it in GitHub Desktop.
int check_arg_type(object_t *obj, int n, ...)
{
va_list args;
type_t type;
int i;
va_start(args, n);
for (i = 0; i < n; i++) {
type = va_arg(args, type_t);
if (obj->type != type) {
fprintf(stderr, "Wrong argument type - %s (wanted %s).",
strtype(obj->type),
strtype(type));
va_end(args);
return 1;
}
}
va_end(args);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment