widl [1/2]: Use ref_type to simplify some code
Dan Hipschman
dsh at linux.ucla.edu
Fri Aug 11 19:32:47 CDT 2006
This uses ref_types to simplify some code, and makes it available for use
in other parts of WIDL later.
ChangeLog:
* Use ref_type in a few places to simplify code
---
tools/widl/parser.y | 5 +----
tools/widl/typegen.c | 2 +-
tools/widl/widltypes.h | 3 +++
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index ca5db5c..73ccf25 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1235,10 +1235,7 @@ static unsigned char get_pointer_type( t
int t;
if (is_attr( type->attrs, ATTR_STRING ))
{
- type_t *t = type;
- while( t->type == 0 && t->ref )
- t = t->ref;
- switch( t->type )
+ switch( ref_type( type ) )
{
case RPC_FC_CHAR:
return RPC_FC_C_CSTRING;
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index badf124..83af2eb 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -165,7 +165,7 @@ static inline int is_base_type(unsigned
}
}
-static unsigned char ref_type(const type_t *type)
+unsigned char ref_type(const type_t *type)
{
while (type_has_ref(type))
type = type->ref;
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 7bf2229..926a3e2 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -297,4 +297,7 @@ struct _typelib_t {
importlib_t *importlibs;
};
+/* Get the actual type field for a type (chase down typedef references). */
+unsigned char ref_type(const type_t *type);
+
#endif
More information about the wine-patches
mailing list