diff options
author | Lev Walkin <vlm@lionet.info> | 2004-09-17 06:32:12 +0000 |
---|---|---|
committer | Lev Walkin <vlm@lionet.info> | 2004-09-17 06:32:12 +0000 |
commit | 8dd0eedc2d59a465622bf7412a9737269a846a06 (patch) | |
tree | fbbd26e445d6b7f7c927ef21cb207c224057da80 /libasn1compiler/asn1c_misc.c | |
parent | f6ac3c8b54ea5015c744fe44b47dfb06e52daec6 (diff) |
better type naming
Diffstat (limited to 'libasn1compiler/asn1c_misc.c')
-rw-r--r-- | libasn1compiler/asn1c_misc.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c index 1c4912d6..86edb52b 100644 --- a/libasn1compiler/asn1c_misc.c +++ b/libasn1compiler/asn1c_misc.c @@ -112,23 +112,17 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) { return asn1c_type_name(&tmp, tmp.expr, _format); } - if(_format == TNF_RSAFE || _format == TNF_CTYPE) { + if(_format == TNF_CTYPE) { /* - * The recursion-safe format is requested. - * The problem here is that only constructed types - * might be referenced with "struct". - * Change RSAFE to CTYPE if the terminal type - * is primitive. + * If the component references the type itself, + * switch to a recursion safe type representation + * ("struct foo" instead of "foo_t"). */ asn1p_expr_t *terminal; terminal = asn1f_find_terminal_type_ex( - arg->asn, arg->mod, arg->expr); - if(terminal) { - if(terminal->expr_type - & (ASN_BASIC_MASK | ASN_STRING_MASK)) - _format = TNF_CTYPE; - if(terminal == top_parent) - _format = TNF_RSAFE; + arg->asn, arg->mod, expr); + if(terminal && terminal == top_parent) { + _format = TNF_RSAFE; } } break; @@ -179,7 +173,7 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) { _format = TNF_CTYPE; typename = ASN_EXPR_TYPE2STR(expr->expr_type); } else { - _format = TNF_SAFE; + _format = TNF_RSAFE; typename = expr->Identifier; } } @@ -196,7 +190,7 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) { return asn1c_make_identifier(0, "struct", " ", typename, 0); } - assert("!unreachable"); + assert(!"unreachable"); return typename; } |