explain_prologue(char *buf, size_t n, struct cdecl_declarator *d)
{
while (d) {
- if (d->type == CDECL_DECL_IDENT) {
- if (!d->u.ident)
- return snprintf(buf, n, "type");
+ switch (d->type) {
+ case CDECL_DECL_NULL:
+ return snprintf(buf, n, "type");
+ case CDECL_DECL_IDENT:
return snprintf(buf, n, "declare %s as", d->u.ident);
}
+
d = d->child;
}
}
{
size_t ret = 0, rc;
- if (d->type == CDECL_DECL_IDENT)
+ if (d->type == CDECL_DECL_IDENT || d->type == CDECL_DECL_NULL)
return 0;
rc = explain_declarators(buf, n, d->child);