[PATCH 02/11] dbghelp: Eliminate an unnecessary parameter from macho_load_debug_info().

Ken Thomases ken at codeweavers.com
Wed Jun 24 17:13:54 CDT 2015


>From outside of macho_module.c, it's only called with NULL.  When it's called
with a non-NULL parameter, it's just a thin wrapper around
macho_load_debug_info_from_map(), so the code can just call that directly.
---
 dlls/dbghelp/dbghelp_private.h |  3 +--
 dlls/dbghelp/macho_module.c    | 20 ++++++++------------
 dlls/dbghelp/module.c          |  2 +-
 3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index 56a5bb8..b620020 100644
--- a/dlls/dbghelp/dbghelp_private.h
+++ b/dlls/dbghelp/dbghelp_private.h
@@ -572,8 +572,7 @@ extern int          elf_is_in_thunk_area(unsigned long addr, const struct elf_th
 #define MACHO_NO_MAP    ((const void*)-1)
 extern BOOL         macho_enum_modules(HANDLE hProc, enum_modules_cb, void*) DECLSPEC_HIDDEN;
 extern BOOL         macho_fetch_file_info(const WCHAR* name, DWORD_PTR* base, DWORD* size, DWORD* checksum) DECLSPEC_HIDDEN;
-struct macho_file_map;
-extern BOOL         macho_load_debug_info(struct module* module, struct macho_file_map* fmap) DECLSPEC_HIDDEN;
+extern BOOL         macho_load_debug_info(struct module* module) DECLSPEC_HIDDEN;
 extern struct module*
                     macho_load_module(struct process* pcs, const WCHAR* name, unsigned long) DECLSPEC_HIDDEN;
 extern BOOL         macho_read_wine_loader_dbg_info(struct process* pcs) DECLSPEC_HIDDEN;
diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c
index bb49aa5..31beafa 100644
--- a/dlls/dbghelp/macho_module.c
+++ b/dlls/dbghelp/macho_module.c
@@ -901,12 +901,12 @@ static BOOL macho_load_debug_info_from_map(struct module* module,
  *
  * Loads Mach-O debugging information from the module image file.
  */
-BOOL macho_load_debug_info(struct module* module, struct macho_file_map* fmap)
+BOOL macho_load_debug_info(struct module* module)
 {
     BOOL                    ret = TRUE;
-    struct macho_file_map   my_fmap;
+    struct macho_file_map   fmap;
 
-    TRACE("(%p, %p/%d)\n", module, fmap, fmap ? fmap->fd : -1);
+    TRACE("(%p)\n", module);
 
     if (module->type != DMT_MACHO || !module->format_info[DFI_MACHO]->u.macho_info)
     {
@@ -914,15 +914,11 @@ BOOL macho_load_debug_info(struct module* module, struct macho_file_map* fmap)
         return FALSE;
     }
 
-    if (!fmap)
-    {
-        fmap = &my_fmap;
-        ret = macho_map_file(module->module.LoadedImageName, fmap);
-    }
+    ret = macho_map_file(module->module.LoadedImageName, &fmap);
     if (ret)
-        ret = macho_load_debug_info_from_map(module, fmap);
+        ret = macho_load_debug_info_from_map(module, &fmap);
 
-    if (fmap == &my_fmap) macho_unmap_file(fmap);
+    macho_unmap_file(&fmap);
     return ret;
 }
 
@@ -1048,7 +1044,7 @@ static BOOL macho_load_file(struct process* pcs, const WCHAR* filename,
 
         if (dbghelp_options & SYMOPT_DEFERRED_LOADS)
             macho_info->module->module.SymType = SymDeferred;
-        else if (!macho_load_debug_info(macho_info->module, &fmap))
+        else if (!macho_load_debug_info_from_map(macho_info->module, &fmap))
             ret = FALSE;
 
         macho_info->module->format_info[DFI_MACHO]->u.macho_info->in_use = 1;
@@ -1480,7 +1476,7 @@ struct module*  macho_load_module(struct process* pcs, const WCHAR* name, unsign
     return NULL;
 }
 
-BOOL macho_load_debug_info(struct module* module, struct macho_file_map* fmap)
+BOOL macho_load_debug_info(struct module* module)
 {
     return FALSE;
 }
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c
index 15769e8..10b0107 100644
--- a/dlls/dbghelp/module.c
+++ b/dlls/dbghelp/module.c
@@ -366,7 +366,7 @@ BOOL module_get_debug(struct module_pair* pair)
                          &idslW64);
             break;
         case DMT_MACHO:
-            ret = macho_load_debug_info(pair->effective, NULL);
+            ret = macho_load_debug_info(pair->effective);
             break;
         default:
             ret = FALSE;
-- 
1.9.5 (Apple Git-50.3)




More information about the wine-patches mailing list