Michael Stefaniuc : winedump: Simplify the "pointer to start of array" idiom.

Alexandre Julliard julliard at winehq.org
Mon Jul 23 13:54:23 CDT 2012


Module: wine
Branch: master
Commit: 19c9d083047f1af8517662a1687df353581d3e0e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=19c9d083047f1af8517662a1687df353581d3e0e

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Mon Jul 23 10:37:06 2012 +0200

winedump: Simplify the "pointer to start of array" idiom.

---

 tools/winedump/debug.c    |    2 +-
 tools/winedump/minidump.c |    8 ++++----
 tools/winedump/pdb.c      |    8 ++++----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/winedump/debug.c b/tools/winedump/debug.c
index c59efa6..961cf42 100644
--- a/tools/winedump/debug.c
+++ b/tools/winedump/debug.c
@@ -500,7 +500,7 @@ static const char *get_coff_name( const IMAGE_SYMBOL *coff_sym, const char *coff
       {
          memcpy(namebuff, coff_sym->N.ShortName, 8);
          namebuff[8] = '\0';
-         nampnt = &namebuff[0];
+         nampnt = namebuff;
       }
    else
       {
diff --git a/tools/winedump/minidump.c b/tools/winedump/minidump.c
index ddd0ed6..aaa9dff 100644
--- a/tools/winedump/minidump.c
+++ b/tools/winedump/minidump.c
@@ -102,7 +102,7 @@ void mdmp_dump(void)
         case ThreadListStream:
         {
             const MINIDUMP_THREAD_LIST* mtl = (const MINIDUMP_THREAD_LIST*)stream;
-            const MINIDUMP_THREAD*      mt = &mtl->Threads[0];
+            const MINIDUMP_THREAD*      mt = mtl->Threads;
             unsigned int                i;
 
             printf("Threads: %u\n", mtl->NumberOfThreads);
@@ -129,7 +129,7 @@ void mdmp_dump(void)
         case 0xFFF0:
         {
             const MINIDUMP_MODULE_LIST* mml = (const MINIDUMP_MODULE_LIST*)stream;
-            const MINIDUMP_MODULE*      mm = &mml->Modules[0];
+            const MINIDUMP_MODULE*      mm = mml->Modules;
             unsigned int                i;
             const char*                 p1;
             const char*                 p2;
@@ -224,7 +224,7 @@ void mdmp_dump(void)
         case MemoryListStream:
         {
             const MINIDUMP_MEMORY_LIST*         mml = (const MINIDUMP_MEMORY_LIST*)stream;
-            const MINIDUMP_MEMORY_DESCRIPTOR*   mmd = &mml->MemoryRanges[0];
+            const MINIDUMP_MEMORY_DESCRIPTOR*   mmd = mml->MemoryRanges;
             unsigned int                        i;
 
             printf("Memory Ranges: %u\n", mml->NumberOfMemoryRanges);
@@ -333,7 +333,7 @@ void mdmp_dump(void)
             if (msi->ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
             {
                 printf("  x86.VendorId: %.12s\n",
-                       (const char*)&msi->Cpu.X86CpuInfo.VendorId[0]);
+                       (const char*)msi->Cpu.X86CpuInfo.VendorId);
                 printf("  x86.VersionInformation: %x\n",
                        msi->Cpu.X86CpuInfo.VersionInformation);
                 printf("  x86.FeatureInformation: %x\n",
diff --git a/tools/winedump/pdb.c b/tools/winedump/pdb.c
index 7a0bd61..3513452 100644
--- a/tools/winedump/pdb.c
+++ b/tools/winedump/pdb.c
@@ -174,12 +174,12 @@ static unsigned get_stream_by_name(struct pdb_reader* reader, const char* name)
 
     if (reader->read_file == pdb_jg_read_file)
     {
-        str = &reader->u.jg.root->names[0];
+        str = reader->u.jg.root->names;
         cbstr = reader->u.jg.root->cbNames;
     }
     else
     {
-        str = &reader->u.ds.root->names[0];
+        str = reader->u.ds.root->names;
         cbstr = reader->u.ds.root->cbNames;
     }
 
@@ -740,7 +740,7 @@ static void pdb_jg_dump(void)
                reader.u.jg.root->Age,
                (unsigned)reader.u.jg.root->cbNames);
 
-        pdw = (DWORD*)(&reader.u.jg.root->names[0] + reader.u.jg.root->cbNames);
+        pdw = (DWORD*)(reader.u.jg.root->names + reader.u.jg.root->cbNames);
         numok = *pdw++;
         count = *pdw++;
         printf("\tStreams directory:\n"
@@ -895,7 +895,7 @@ static void pdb_ds_dump(void)
                reader.u.ds.root->Age,
                get_guid_str(&reader.u.ds.root->guid),
                reader.u.ds.root->cbNames);
-        pdw = (DWORD*)(&reader.u.ds.root->names[0] + reader.u.ds.root->cbNames);
+        pdw = (DWORD*)(reader.u.ds.root->names + reader.u.ds.root->cbNames);
         numok = *pdw++;
         count = *pdw++;
         printf("\tStreams directory:\n"




More information about the wine-cvs mailing list