[1/4] widl: Move is_void(), is_declptr() and is_conformant_array() to header.h and make them inline.

Dmitry Timoshkov dmitry at baikal.ru
Thu Mar 20 04:32:39 CDT 2014


This patch moves them to a common place with other simlar helpers.
---
 tools/widl/header.c  | 10 ----------
 tools/widl/header.h  | 18 +++++++++++++++---
 tools/widl/typegen.c |  5 -----
 3 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/tools/widl/header.c b/tools/widl/header.c
index 4ca6ed5..4f2222a 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -109,16 +109,6 @@ unsigned int get_attrv(const attr_list_t *list, enum attr_type t)
     return 0;
 }
 
-int is_void(const type_t *t)
-{
-    return type_get_type(t) == TYPE_VOID;
-}
-
-int is_conformant_array(const type_t *t)
-{
-    return is_array(t) && type_array_has_conformance(t);
-}
-
 static void write_guid(FILE *f, const char *guid_prefix, const char *name, const UUID *uuid)
 {
   if (!uuid) return;
diff --git a/tools/widl/header.h b/tools/widl/header.h
index 8ca1cf1..10601ff 100644
--- a/tools/widl/header.h
+++ b/tools/widl/header.h
@@ -28,9 +28,6 @@ extern int is_aliaschain_attr(const type_t *var, enum attr_type t);
 extern int is_attr(const attr_list_t *list, enum attr_type t);
 extern void *get_attrp(const attr_list_t *list, enum attr_type t);
 extern unsigned int get_attrv(const attr_list_t *list, enum attr_type t);
-extern int is_void(const type_t *t);
-extern int is_conformant_array(const type_t *t);
-extern int is_declptr(const type_t *t);
 extern const char* get_name(const var_t *v);
 extern void write_type_left(FILE *h, type_t *t, int declonly);
 extern void write_type_right(FILE *h, type_t *t, int is_field);
@@ -68,6 +65,21 @@ static inline int is_array(const type_t *t)
     return type_get_type(t) == TYPE_ARRAY;
 }
 
+static inline int is_void(const type_t *t)
+{
+    return type_get_type(t) == TYPE_VOID;
+}
+
+static inline int is_declptr(const type_t *t)
+{
+    return is_ptr(t) || (type_get_type(t) == TYPE_ARRAY && type_array_is_decl_as_ptr(t));
+}
+
+static inline int is_conformant_array(const type_t *t)
+{
+    return is_array(t) && type_array_has_conformance(t);
+}
+
 static inline int last_ptr(const type_t *type)
 {
     return is_ptr(type) && !is_declptr(type_pointer_get_ref(type));
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index d017521..37d18f5 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -2774,11 +2774,6 @@ static void write_pointer_description(FILE *file, type_t *type,
             &offset_in_memory, &offset_in_buffer, typestring_offset);
 }
 
-int is_declptr(const type_t *t)
-{
-  return is_ptr(t) || (type_get_type(t) == TYPE_ARRAY && type_array_is_decl_as_ptr(t));
-}
-
 static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
                                      type_t *type, enum type_context context,
                                      const char *name, unsigned int *typestring_offset)
-- 
1.9.1




More information about the wine-patches mailing list