widl: Replace get_name with a field reference.
This commit is contained in:
parent
6cf8e6bd77
commit
f5baddf88a
|
@ -141,11 +141,6 @@ void write_prefix_name(FILE *h, const char *prefix, const var_t *v)
|
||||||
write_name(h, v);
|
write_name(h, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* get_name(const var_t *v)
|
|
||||||
{
|
|
||||||
return v->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void write_array(FILE *h, array_dims_t *dims, int field)
|
void write_array(FILE *h, array_dims_t *dims, int field)
|
||||||
{
|
{
|
||||||
expr_t *v;
|
expr_t *v;
|
||||||
|
@ -170,7 +165,7 @@ static void write_field(FILE *h, var_t *v)
|
||||||
if (v->type) {
|
if (v->type) {
|
||||||
indent(h, 0);
|
indent(h, 0);
|
||||||
write_type(h, v->type);
|
write_type(h, v->type);
|
||||||
if (get_name(v))
|
if (v->name)
|
||||||
fprintf(h, " %s", v->name);
|
fprintf(h, " %s", v->name);
|
||||||
else {
|
else {
|
||||||
/* not all C/C++ compilers support anonymous structs and unions */
|
/* not all C/C++ compilers support anonymous structs and unions */
|
||||||
|
@ -210,7 +205,7 @@ static void write_enums(FILE *h, var_list_t *enums)
|
||||||
if (!enums) return;
|
if (!enums) return;
|
||||||
LIST_FOR_EACH_ENTRY( v, enums, var_t, entry )
|
LIST_FOR_EACH_ENTRY( v, enums, var_t, entry )
|
||||||
{
|
{
|
||||||
if (get_name(v)) {
|
if (v->name) {
|
||||||
indent(h, 0);
|
indent(h, 0);
|
||||||
write_name(h, v);
|
write_name(h, v);
|
||||||
if (v->eval) {
|
if (v->eval) {
|
||||||
|
@ -444,7 +439,7 @@ void write_expr(FILE *h, const expr_t *e, int brackets)
|
||||||
|
|
||||||
void write_constdef(const var_t *v)
|
void write_constdef(const var_t *v)
|
||||||
{
|
{
|
||||||
fprintf(header, "#define %s (", get_name(v));
|
fprintf(header, "#define %s (", v->name);
|
||||||
write_expr(header, v->eval, 0);
|
write_expr(header, v->eval, 0);
|
||||||
fprintf(header, ")\n\n");
|
fprintf(header, ")\n\n");
|
||||||
}
|
}
|
||||||
|
@ -453,7 +448,7 @@ void write_externdef(const var_t *v)
|
||||||
{
|
{
|
||||||
fprintf(header, "extern const ");
|
fprintf(header, "extern const ");
|
||||||
write_type(header, v->type);
|
write_type(header, v->type);
|
||||||
if (get_name(v))
|
if (v->name)
|
||||||
fprintf(header, " %s", v->name);
|
fprintf(header, " %s", v->name);
|
||||||
fprintf(header, ";\n\n");
|
fprintf(header, ";\n\n");
|
||||||
}
|
}
|
||||||
|
@ -688,7 +683,7 @@ static void write_method_proto(const type_t *iface)
|
||||||
if (cas) {
|
if (cas) {
|
||||||
const func_t *m;
|
const func_t *m;
|
||||||
LIST_FOR_EACH_ENTRY( m, iface->funcs, const func_t, entry )
|
LIST_FOR_EACH_ENTRY( m, iface->funcs, const func_t, entry )
|
||||||
if (!strcmp(get_name(m->def), cas->name)) break;
|
if (!strcmp(m->def->name, cas->name)) break;
|
||||||
if (&m->entry != iface->funcs) {
|
if (&m->entry != iface->funcs) {
|
||||||
const var_t *mdef = m->def;
|
const var_t *mdef = m->def;
|
||||||
/* proxy prototype - use local prototype */
|
/* proxy prototype - use local prototype */
|
||||||
|
@ -707,7 +702,7 @@ static void write_method_proto(const type_t *iface)
|
||||||
fprintf(header, ");\n");
|
fprintf(header, ");\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
parser_warning("invalid call_as attribute (%s -> %s)\n", get_name(def), cas->name);
|
parser_warning("invalid call_as attribute (%s -> %s)\n", def->name, cas->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ extern int is_conformant_array( const array_dims_t *array );
|
||||||
extern int is_non_void(const expr_list_t *list);
|
extern int is_non_void(const expr_list_t *list);
|
||||||
extern void write_name(FILE *h, const var_t *v);
|
extern void write_name(FILE *h, const var_t *v);
|
||||||
extern void write_prefix_name(FILE *h, const char *prefix, const var_t *v);
|
extern void write_prefix_name(FILE *h, const char *prefix, const var_t *v);
|
||||||
extern const char* get_name(const var_t *v);
|
|
||||||
extern void write_type(FILE *h, type_t *t);
|
extern void write_type(FILE *h, type_t *t);
|
||||||
extern int is_object(const attr_list_t *list);
|
extern int is_object(const attr_list_t *list);
|
||||||
extern int is_local(const attr_list_t *list);
|
extern int is_local(const attr_list_t *list);
|
||||||
|
|
|
@ -507,7 +507,7 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset)
|
||||||
if (cname) {
|
if (cname) {
|
||||||
const func_t *m;
|
const func_t *m;
|
||||||
LIST_FOR_EACH_ENTRY( m, iface->funcs, const func_t, entry )
|
LIST_FOR_EACH_ENTRY( m, iface->funcs, const func_t, entry )
|
||||||
if (!strcmp(get_name(m->def), cname))
|
if (!strcmp(m->def->name, cname))
|
||||||
{
|
{
|
||||||
idx = m->idx;
|
idx = m->idx;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue