Commit c8ab4004 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dbghelp: Use CONTAINING_RECORD instead of reimplementing it.

parent 8bd3e4cc
......@@ -112,9 +112,6 @@ void hash_table_iter_init(const struct hash_table* ht,
struct hash_table_iter* hti, const char* name) DECLSPEC_HIDDEN;
void* hash_table_iter_up(struct hash_table_iter* hti) DECLSPEC_HIDDEN;
#define GET_ENTRY(__i, __t, __f) \
((__t*)((char*)(__i) - FIELD_OFFSET(__t,__f)))
extern unsigned dbghelp_options DECLSPEC_HIDDEN;
/* some more Wine extensions */
......
......@@ -659,7 +659,7 @@ static void elf_finish_stabs_info(struct module* module, const struct hash_table
hash_table_iter_init(&module->ht_symbols, &hti, NULL);
while ((ptr = hash_table_iter_up(&hti)))
{
sym = GET_ENTRY(ptr, struct symt_ht, hash_elt);
sym = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
switch (sym->symt.tag)
{
case SymTagFunction:
......
......@@ -920,7 +920,7 @@ static void macho_finish_stabs(struct module* module, struct hash_table* ht_symt
hash_table_iter_init(&module->ht_symbols, &hti_modules, ste->ht_elt.name);
while ((ptr = hash_table_iter_up(&hti_modules)))
{
sym = GET_ENTRY(ptr, struct symt_ht, hash_elt);
sym = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
if (strcmp(sym->hash_elt.name, ste->ht_elt.name))
continue;
......
......@@ -1025,7 +1025,7 @@ static struct symt* codeview_add_type_struct(struct codeview_type_parse* ctp,
hash_table_iter_init(&ctp->module->ht_types, &hti, name);
while ((ptr = hash_table_iter_up(&hti)))
{
type = GET_ENTRY(ptr, struct symt_ht, hash_elt);
type = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
if (type->symt.tag == SymTagUDT &&
type->hash_elt.name && !strcmp(type->hash_elt.name, name))
......@@ -2982,9 +2982,9 @@ static BOOL pev_get_val(struct pevaluator* pev, const char* str, DWORD_PTR* val
hash_table_iter_init(&pev->values, &hti, str);
while ((ptr = hash_table_iter_up(&hti)))
{
if (!strcmp(GET_ENTRY(ptr, struct zvalue, elt)->elt.name, str))
if (!strcmp(CONTAINING_RECORD(ptr, struct zvalue, elt)->elt.name, str))
{
*val = GET_ENTRY(ptr, struct zvalue, elt)->value;
*val = CONTAINING_RECORD(ptr, struct zvalue, elt)->value;
return TRUE;
}
}
......@@ -3037,9 +3037,9 @@ static BOOL pev_set_value(struct pevaluator* pev, const char* name, DWORD_PTR v
hash_table_iter_init(&pev->values, &hti, name);
while ((ptr = hash_table_iter_up(&hti)))
{
if (!strcmp(GET_ENTRY(ptr, struct zvalue, elt)->elt.name, name))
if (!strcmp(CONTAINING_RECORD(ptr, struct zvalue, elt)->elt.name, name))
{
GET_ENTRY(ptr, struct zvalue, elt)->value = val;
CONTAINING_RECORD(ptr, struct zvalue, elt)->value = val;
break;
}
}
......
......@@ -369,7 +369,7 @@ static BOOL pe_locate_with_coff_symbol_table(struct module* module)
hash_table_iter_init(&module->ht_symbols, &hti, name);
while ((ptr = hash_table_iter_up(&hti)))
{
sym = GET_ENTRY(ptr, struct symt_data, hash_elt);
sym = CONTAINING_RECORD(ptr, struct symt_data, hash_elt);
if (sym->symt.tag == SymTagData &&
(sym->kind == DataIsGlobal || sym->kind == DataIsFileStatic) &&
sym->u.var.kind == loc_absolute &&
......
......@@ -422,7 +422,7 @@ struct symt_block* symt_close_func_block(struct module* module,
if (pc) block->size = func->address + pc - block->address;
return (block->container->tag == SymTagBlock) ?
GET_ENTRY(block->container, struct symt_block, symt) : NULL;
CONTAINING_RECORD(block->container, struct symt_block, symt) : NULL;
}
struct symt_hierarchy_point* symt_add_function_point(struct module* module,
......@@ -741,7 +741,7 @@ static BOOL symt_enum_module(struct module_pair* pair, const WCHAR* match,
hash_table_iter_init(&pair->effective->ht_symbols, &hti, NULL);
while ((ptr = hash_table_iter_up(&hti)))
{
sym = GET_ENTRY(ptr, struct symt_ht, hash_elt);
sym = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
nameW = symt_get_nameW(&sym->symt);
ret = SymMatchStringW(nameW, match, FALSE);
HeapFree(GetProcessHeap(), 0, nameW);
......@@ -1329,7 +1329,7 @@ static BOOL find_name(struct process* pcs, struct module* module, const char* na
hash_table_iter_init(&pair.effective->ht_symbols, &hti, name);
while ((ptr = hash_table_iter_up(&hti)))
{
sym = GET_ENTRY(ptr, struct symt_ht, hash_elt);
sym = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
if (!strcmp(sym->hash_elt.name, name))
{
......@@ -2148,7 +2148,7 @@ BOOL WINAPI SymEnumLines(HANDLE hProcess, ULONG64 base, PCSTR compiland,
{
unsigned int i;
sym = GET_ENTRY(ptr, struct symt_ht, hash_elt);
sym = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
if (sym->symt.tag != SymTagFunction) continue;
sci.FileName[0] = '\0';
......
......@@ -170,7 +170,7 @@ static struct symt* symt_find_type_by_name(const struct module* module,
hash_table_iter_init(&module->ht_types, &hti, typename);
while ((ptr = hash_table_iter_up(&hti)))
{
type = GET_ENTRY(ptr, struct symt_ht, hash_elt);
type = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
if ((sym_tag == SymTagNull || type->symt.tag == sym_tag) &&
type->hash_elt.name && !strcmp(type->hash_elt.name, typename))
......
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