Commit 4758df46 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

msvcrt: Misc cleanups in undname.c.

- remove unused argument from functions - print the pointer in the str_array_push TRACE to be able to distinguish the different arrays. - comment and white space cleanups
parent 067be978
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
/* TODO: /* TODO:
* - document a bit (grammar + fonctions) * - document a bit (grammar + functions)
* - back-port this new code into tools/winedump/msmangle.c * - back-port this new code into tools/winedump/msmangle.c
*/ */
...@@ -201,7 +201,7 @@ static void str_array_push(struct parsed_symbol* sym, const char* ptr, size_t le ...@@ -201,7 +201,7 @@ static void str_array_push(struct parsed_symbol* sym, const char* ptr, size_t le
c = '>'; c = '>';
if (i < a->start) c = '-'; if (i < a->start) c = '-';
else if (i >= a->num) c = '}'; else if (i >= a->num) c = '}';
TRACE("\t%d%c %s\n", i, c, a->elts[i]); TRACE("%p\t%d%c %s\n", a, i, c, a->elts[i]);
} }
} }
} }
...@@ -497,15 +497,16 @@ static BOOL get_class(struct parsed_symbol* sym) ...@@ -497,15 +497,16 @@ static BOOL get_class(struct parsed_symbol* sym)
/****************************************************************** /******************************************************************
* get_class_string * get_class_string
* From an array collected by get_class, constructs the corresponding (allocated) * From an array collected by get_class in sym->stack, constructs the
* string * corresponding (allocated) string
*/ */
static char* get_class_string(struct parsed_symbol* sym, /*const struct array* a, */int start) static char* get_class_string(struct parsed_symbol* sym, int start)
{ {
int i; int i;
size_t len, sz; size_t len, sz;
char* ret; char* ret;
struct array *a = &sym->stack; struct array *a = &sym->stack;
for (len = 0, i = start; i < a->num; i++) for (len = 0, i = start; i < a->num; i++)
{ {
assert(a->elts[i]); assert(a->elts[i]);
...@@ -547,9 +548,8 @@ static char* get_class_name(struct parsed_symbol* sym) ...@@ -547,9 +548,8 @@ static char* get_class_name(struct parsed_symbol* sym)
* Returns a static string corresponding to the calling convention described * Returns a static string corresponding to the calling convention described
* by char 'ch'. Sets export to TRUE iff the calling convention is exported. * by char 'ch'. Sets export to TRUE iff the calling convention is exported.
*/ */
static BOOL get_calling_convention(struct parsed_symbol* sym, char ch, static BOOL get_calling_convention(char ch, const char** call_conv,
const char** call_conv, const char** exported, const char** exported, unsigned flags)
unsigned flags)
{ {
*call_conv = *exported = NULL; *call_conv = *exported = NULL;
...@@ -591,7 +591,7 @@ static BOOL get_calling_convention(struct parsed_symbol* sym, char ch, ...@@ -591,7 +591,7 @@ static BOOL get_calling_convention(struct parsed_symbol* sym, char ch,
* get_simple_type * get_simple_type
* Return a string containing an allocated string for a simple data type * Return a string containing an allocated string for a simple data type
*/ */
static const char* get_simple_type(struct parsed_symbol* sym, char c) static const char* get_simple_type(char c)
{ {
const char* type_string; const char* type_string;
...@@ -615,11 +615,12 @@ static const char* get_simple_type(struct parsed_symbol* sym, char c) ...@@ -615,11 +615,12 @@ static const char* get_simple_type(struct parsed_symbol* sym, char c)
} }
return type_string; return type_string;
} }
/******************************************************************* /*******************************************************************
* get_extented_type * get_extented_type
* Return a string containing an allocated string for a simple data type * Return a string containing an allocated string for a simple data type
*/ */
static const char* get_extended_type(struct parsed_symbol* sym, char c) static const char* get_extended_type(char c)
{ {
const char* type_string; const char* type_string;
...@@ -663,13 +664,13 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, ...@@ -663,13 +664,13 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
{ {
case '_': case '_':
/* MS type: __int8,__int16 etc */ /* MS type: __int8,__int16 etc */
ct->left = get_extended_type(sym, *sym->current++); ct->left = get_extended_type(*sym->current++);
break; break;
case 'C': case 'D': case 'E': case 'F': case 'G': case 'C': case 'D': case 'E': case 'F': case 'G':
case 'H': case 'I': case 'J': case 'K': case 'M': case 'H': case 'I': case 'J': case 'K': case 'M':
case 'N': case 'O': case 'X': case 'Z': case 'N': case 'O': case 'X': case 'Z':
/* Simple data types */ /* Simple data types */
ct->left = get_simple_type(sym, dt); ct->left = get_simple_type(dt);
add_pmt = FALSE; add_pmt = FALSE;
break; break;
case 'T': /* union */ case 'T': /* union */
...@@ -719,7 +720,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, ...@@ -719,7 +720,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
struct datatype_t sub_ct; struct datatype_t sub_ct;
unsigned mark = sym->stack.num; unsigned mark = sym->stack.num;
if (!get_calling_convention(sym, *sym->current++, if (!get_calling_convention(*sym->current++,
&call_conv, &exported, &call_conv, &exported,
sym->flags & ~UNDNAME_NO_ALLOCATION_LANGUAGE) || sym->flags & ~UNDNAME_NO_ALLOCATION_LANGUAGE) ||
!demangle_datatype(sym, &sub_ct, pmt_ref, FALSE)) !demangle_datatype(sym, &sub_ct, pmt_ref, FALSE))
...@@ -964,8 +965,8 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op) ...@@ -964,8 +965,8 @@ static BOOL handle_method(struct parsed_symbol* sym, BOOL cast_op)
name = get_class_string(sym, 0); name = get_class_string(sym, 0);
if (!get_calling_convention(sym, *sym->current++, if (!get_calling_convention(*sym->current++, &call_conv, &exported,
&call_conv, &exported, sym->flags)) sym->flags))
goto done; goto done;
str_array_init(&array_pmt); str_array_init(&array_pmt);
...@@ -1010,7 +1011,7 @@ done: ...@@ -1010,7 +1011,7 @@ done:
} }
/******************************************************************* /*******************************************************************
* demangle_symbol * symbol_demangle
* Demangle a C++ linker symbol * Demangle a C++ linker symbol
*/ */
static BOOL symbol_demangle(struct parsed_symbol* sym) static BOOL symbol_demangle(struct parsed_symbol* sym)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment