[unDName 1/5]: Wrap get_class() and get_class_string()

Michael Stefaniuc mstefani at redhat.de
Sat Feb 18 12:34:20 CST 2006


Make a wrapper around get_class() and get_class_string().

---

 dlls/msvcrt/undname.c |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

9408d355c4e9eec12b4bee1748fa5f4288a5b9b5
diff --git a/dlls/msvcrt/undname.c b/dlls/msvcrt/undname.c
index 16e21d8..4318ca8 100644
--- a/dlls/msvcrt/undname.c
+++ b/dlls/msvcrt/undname.c
@@ -491,6 +491,21 @@ static char* get_class_string(struct par
 }
 
 /******************************************************************
+ *            get_class_name
+ * Wrapper around get_class and get_class_string.
+ */
+static char* get_class_name(struct parsed_symbol* sym)
+{
+    unsigned    mark = sym->stack.num;
+    char*       s = NULL;
+
+    if (get_class(sym))
+        s = get_class_string(sym, mark);
+    sym->stack.num = mark;
+    return s;
+}
+
+/******************************************************************
  *		get_calling_convention
  * Returns a static string corresponding to the calling convention described
  * by char 'ch'. Sets export to TRUE iff the calling convention is exported.
@@ -625,13 +640,11 @@ static BOOL demangle_datatype(struct par
     case 'V': /* class */
         /* Class/struct/union */
         {
-            unsigned    mark = sym->stack.num;
             const char* struct_name = NULL;
             const char* type_name = NULL;
 
-            if (!get_class(sym) ||
-                !(struct_name = get_class_string(sym, mark))) goto done;
-            sym->stack.num = mark;
+            if (!(struct_name = get_class_name(sym)))
+                goto done;
             if (!(sym->flags & UNDNAME_NO_COMPLEX_TYPE)) 
             {
                 switch (dt)
@@ -691,11 +704,9 @@ static BOOL demangle_datatype(struct par
         if (*sym->current == '4')
         {
             char*               enum_name;
-            unsigned            mark = sym->stack.num;
             sym->current++;
-            if (!get_class(sym) ||
-                !(enum_name = get_class_string(sym, mark))) goto done;
-            sym->stack.num = mark;
+            if (!(enum_name = get_class_name(sym)))
+                goto done;
             if (sym->flags & UNDNAME_NO_COMPLEX_TYPE)
                 ct->left = enum_name;
             else
@@ -813,12 +824,10 @@ static BOOL handle_data(struct parsed_sy
         if (!get_modifier(*sym->current++, &modifier)) goto done;
         if (*sym->current != '@')
         {
-            unsigned    mark = sym->stack.num;
             char*       cls = NULL;
 
-            if (!get_class(sym) ||
-                !(cls = get_class_string(sym, mark))) goto done;
-            sym->stack.num = mark;
+            if (!(cls = get_class_name(sym)))
+                goto done;
             ct.right = str_printf(sym, "{for `%s'}", cls);
         }
         break;
-- 
1.2.1

-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
Sr. Network Engineer            Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani at redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060218/d74c498f/attachment.pgp


More information about the wine-patches mailing list