From: Eric Pouech epouech@codeweavers.com
We're going to introduce a couple more helpers in next patches, so make it more readable.
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/dbghelp.c | 2 +- dlls/dbghelp/dbghelp_private.h | 4 ++-- dlls/dbghelp/symbol.c | 8 +++---- dlls/dbghelp/type.c | 42 +++++++++++++++++----------------- 4 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c index 5a023152ec4..73c7f1eb969 100644 --- a/dlls/dbghelp/dbghelp.c +++ b/dlls/dbghelp/dbghelp.c @@ -722,7 +722,7 @@ BOOL WINAPI SymSetScopeFromIndex(HANDLE hProcess, ULONG64 addr, DWORD index) TRACE("(%p %#I64x %lu)\n", hProcess, addr, index);
if (!module_init_pair(&pair, hProcess, addr)) return FALSE; - sym = symt_index2ptr(pair.effective, index); + sym = symt_index_to_ptr(pair.effective, index); if (!symt_check_tag(sym, SymTagFunction)) return FALSE;
pair.pcs->localscope_pc = ((struct symt_function*)sym)->ranges[0].low; /* FIXME of FuncDebugStart when it exists? */ diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index f2c74f05d24..bfa6b41af61 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -961,8 +961,8 @@ extern struct symt_hierarchy_point* symt_new_label(struct module* module, struct symt_compiland* compiland, const char* name, ULONG_PTR address); -extern struct symt* symt_index2ptr(struct module* module, DWORD id); -extern DWORD symt_ptr2index(struct module* module, const struct symt* sym); +extern struct symt* symt_index_to_ptr(struct module* module, DWORD id); +extern DWORD symt_ptr_to_index(struct module* module, const struct symt* sym); extern struct symt_custom* symt_new_custom(struct module* module, const char* name, DWORD64 addr, DWORD size); diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 6913b82b836..01d3267808b 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -70,7 +70,7 @@ int __cdecl symt_cmp_addr(const void* p1, const void* p2) * which is exposed to the caller and index is the index of the symbol in * this array */ -DWORD symt_ptr2index(struct module* module, const struct symt* sym) +DWORD symt_ptr_to_index(struct module* module, const struct symt* sym) { struct vector* vector; DWORD offset; @@ -105,7 +105,7 @@ DWORD symt_ptr2index(struct module* module, const struct symt* sym) return len + offset; }
-struct symt* symt_index2ptr(struct module* module, DWORD id) +struct symt* symt_index_to_ptr(struct module* module, DWORD id) { struct vector* vector; if (id >= BASE_CUSTOM_SYMT) @@ -704,7 +704,7 @@ static BOOL symt_fill_sym_info(struct module_pair* pair,
if (!symt_get_info(pair->effective, sym, TI_GET_TYPE, &sym_info->TypeIndex)) sym_info->TypeIndex = 0; - sym_info->Index = symt_ptr2index(pair->effective, sym); + sym_info->Index = symt_ptr_to_index(pair->effective, sym); sym_info->Reserved[0] = sym_info->Reserved[1] = 0; if (!symt_get_info(pair->effective, sym, TI_GET_LENGTH, &size) && (!sym_info->TypeIndex || @@ -2655,7 +2655,7 @@ BOOL WINAPI SymFromIndex(HANDLE hProcess, ULONG64 BaseOfDll, DWORD index, PSYMBO hProcess, BaseOfDll, index, symbol);
if (!module_init_pair(&pair, hProcess, BaseOfDll)) return FALSE; - if ((sym = symt_index2ptr(pair.effective, index)) == NULL) return FALSE; + if ((sym = symt_index_to_ptr(pair.effective, index)) == NULL) return FALSE; symt_fill_sym_info(&pair, NULL, sym, symbol); return TRUE; } diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 97abb60f64d..0f3a94453a0 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -464,7 +464,7 @@ static BOOL sym_enum_types(struct module_pair *pair, const char *type_name, PSYM
if (type_name && !SymMatchStringA(type->hash_elt.name, type_name, TRUE)) continue;
- sym_info->TypeIndex = symt_ptr2index(pair->effective, &type->symt); + sym_info->TypeIndex = symt_ptr_to_index(pair->effective, &type->symt); sym_info->Index = 0; /* FIXME */ symt_get_info(pair->effective, &type->symt, TI_GET_LENGTH, &size); sym_info->Size = size; @@ -666,7 +666,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, for (i = 0; i < tifp->Count; i++) { if (!(pt = vector_at(v, tifp->Start + i))) return FALSE; - tifp->ChildId[i] = symt_ptr2index(module, *pt); + tifp->ChildId[i] = symt_ptr_to_index(module, *pt); } } break; @@ -845,25 +845,25 @@ BOOL symt_get_info(struct module* module, const struct symt* type, switch (type->tag) { case SymTagCompiland: - X(DWORD) = symt_ptr2index(module, &((const struct symt_compiland*)type)->container->symt); + X(DWORD) = symt_ptr_to_index(module, &((const struct symt_compiland*)type)->container->symt); break; case SymTagBlock: - X(DWORD) = symt_ptr2index(module, ((const struct symt_block*)type)->container); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_block*)type)->container); break; case SymTagData: - X(DWORD) = symt_ptr2index(module, ((const struct symt_data*)type)->container); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_data*)type)->container); break; case SymTagFunction: case SymTagInlineSite: - X(DWORD) = symt_ptr2index(module, ((const struct symt_function*)type)->container); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_function*)type)->container); break; case SymTagThunk: - X(DWORD) = symt_ptr2index(module, ((const struct symt_thunk*)type)->container); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_thunk*)type)->container); break; case SymTagFuncDebugStart: case SymTagFuncDebugEnd: case SymTagLabel: - X(DWORD) = symt_ptr2index(module, ((const struct symt_hierarchy_point*)type)->parent); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_hierarchy_point*)type)->parent); break; case SymTagUDT: case SymTagEnum: @@ -876,7 +876,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, case SymTagBaseClass: case SymTagPublicSymbol: case SymTagCustom: - X(DWORD) = symt_ptr2index(module, &module->top->symt); + X(DWORD) = symt_ptr_to_index(module, &module->top->symt); break; default: FIXME("Unsupported sym-tag %s for get-lexical-parent\n", @@ -981,30 +981,30 @@ BOOL symt_get_info(struct module* module, const struct symt* type, { /* hierarchical => hierarchical */ case SymTagArrayType: - X(DWORD) = symt_ptr2index(module, ((const struct symt_array*)type)->base_type); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_array*)type)->base_type); break; case SymTagPointerType: - X(DWORD) = symt_ptr2index(module, ((const struct symt_pointer*)type)->pointsto); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_pointer*)type)->pointsto); break; case SymTagFunctionType: - X(DWORD) = symt_ptr2index(module, ((const struct symt_function_signature*)type)->rettype); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_function_signature*)type)->rettype); break; case SymTagTypedef: - X(DWORD) = symt_ptr2index(module, ((const struct symt_typedef*)type)->type); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_typedef*)type)->type); break; /* lexical => hierarchical */ case SymTagData: - X(DWORD) = symt_ptr2index(module, ((const struct symt_data*)type)->type); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_data*)type)->type); break; case SymTagFunction: case SymTagInlineSite: - X(DWORD) = symt_ptr2index(module, ((const struct symt_function*)type)->type); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_function*)type)->type); break; case SymTagEnum: - X(DWORD) = symt_ptr2index(module, ((const struct symt_enum*)type)->base_type); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_enum*)type)->base_type); break; case SymTagFunctionArgType: - X(DWORD) = symt_ptr2index(module, ((const struct symt_function_arg_type*)type)->arg_type); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_function_arg_type*)type)->arg_type); break; default: FIXME("Unsupported sym-tag %s for get-type\n", @@ -1069,7 +1069,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, break; case TI_GET_ARRAYINDEXTYPEID: if (type->tag != SymTagArrayType) return FALSE; - X(DWORD) = symt_ptr2index(module, ((const struct symt_array*)type)->index_type); + X(DWORD) = symt_ptr_to_index(module, ((const struct symt_array*)type)->index_type); break;
case TI_GET_SYMINDEX: @@ -1077,7 +1077,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, * native sometimes (eg for UDT) return id of another instance * of the same UDT definition... maybe forward declaration? */ - X(DWORD) = symt_ptr2index(module, type); + X(DWORD) = symt_ptr_to_index(module, type); break;
/* FIXME: we don't support properly C++ for now */ @@ -1114,7 +1114,7 @@ BOOL symt_get_info(struct module* module, const struct symt* type, BOOL symt_get_info_from_index(struct module* module, DWORD index, IMAGEHLP_SYMBOL_TYPE_INFO req, void* pInfo) { - return symt_get_info(module, symt_index2ptr(module, index), req, pInfo); + return symt_get_info(module, symt_index_to_ptr(module, index), req, pInfo); }
/****************************************************************** @@ -1145,7 +1145,7 @@ BOOL WINAPI SymGetTypeFromName(HANDLE hProcess, ULONG64 BaseOfDll, if (!module_init_pair(&pair, hProcess, BaseOfDll)) return FALSE; type = symt_find_type_by_name(pair.effective, SymTagNull, Name); if (!type) return FALSE; - Symbol->Index = Symbol->TypeIndex = symt_ptr2index(pair.effective, type); + Symbol->Index = Symbol->TypeIndex = symt_ptr_to_index(pair.effective, type); symbol_setname(Symbol, symt_get_name(type)); symt_get_info(pair.effective, type, TI_GET_LENGTH, &size); Symbol->Size = size;