All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Reif <reif@earthlink.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] exec.c remove unnecessary operators on	functions
Date: Fri, 20 Feb 2009 15:37:38 -0500	[thread overview]
Message-ID: <499F1492.5080602@earthlink.net> (raw)
In-Reply-To: <499EF249.4000005@earthlink.net>

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

Robert Reif wrote:
>
> Also, why is it necessary to take the address of a variable holding a
> function address rather than saving the function address directly
> in exec.c lines 2766 and 2771?
>
>
This removes the extra level of indirection.  Comments?

[-- Attachment #2: subpage.diff.txt --]
[-- Type: text/plain, Size: 2655 bytes --]

--- exec.c	(revision 6629)
+++ exec.c	(working copy)
@@ -197,8 +197,8 @@
 #define SUBPAGE_IDX(addr) ((addr) & ~TARGET_PAGE_MASK)
 typedef struct subpage_t {
     target_phys_addr_t base;
-    CPUReadMemoryFunc **mem_read[TARGET_PAGE_SIZE][4];
-    CPUWriteMemoryFunc **mem_write[TARGET_PAGE_SIZE][4];
+    CPUReadMemoryFunc *mem_read[TARGET_PAGE_SIZE][4];
+    CPUWriteMemoryFunc *mem_write[TARGET_PAGE_SIZE][4];
     void *opaque[TARGET_PAGE_SIZE][2][4];
     ram_addr_t region_offset[TARGET_PAGE_SIZE][2][4];
 } subpage_t;
@@ -2658,7 +2658,7 @@
     printf("%s: subpage %p len %d addr " TARGET_FMT_plx " idx %d\n", __func__,
            mmio, len, addr, idx);
 #endif
-    ret = (**mmio->mem_read[idx][len])(mmio->opaque[idx][0][len],
+    ret = mmio->mem_read[idx][len](mmio->opaque[idx][0][len],
                                        addr + mmio->region_offset[idx][0][len]);
 
     return ret;
@@ -2674,7 +2674,7 @@
     printf("%s: subpage %p len %d addr " TARGET_FMT_plx " idx %d value %08x\n", __func__,
            mmio, len, addr, idx, value);
 #endif
-    (**mmio->mem_write[idx][len])(mmio->opaque[idx][1][len],
+    mmio->mem_write[idx][len](mmio->opaque[idx][1][len],
                                   addr + mmio->region_offset[idx][1][len],
                                   value);
 }
@@ -2733,16 +2733,16 @@
     subpage_writelen(opaque, addr, value, 2);
 }
 
-static CPUReadMemoryFunc *subpage_read[] = {
-    &subpage_readb,
-    &subpage_readw,
-    &subpage_readl,
+static CPUReadMemoryFunc *subpage_read[3] = {
+    subpage_readb,
+    subpage_readw,
+    subpage_readl,
 };
 
-static CPUWriteMemoryFunc *subpage_write[] = {
-    &subpage_writeb,
-    &subpage_writew,
-    &subpage_writel,
+static CPUWriteMemoryFunc *subpage_write[3] = {
+    subpage_writeb,
+    subpage_writew,
+    subpage_writel,
 };
 
 static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
@@ -2763,12 +2763,12 @@
     for (; idx <= eidx; idx++) {
         for (i = 0; i < 4; i++) {
             if (io_mem_read[memory][i]) {
-                mmio->mem_read[idx][i] = &io_mem_read[memory][i];
+                mmio->mem_read[idx][i] = io_mem_read[memory][i];
                 mmio->opaque[idx][0][i] = io_mem_opaque[memory];
                 mmio->region_offset[idx][0][i] = region_offset;
             }
             if (io_mem_write[memory][i]) {
-                mmio->mem_write[idx][i] = &io_mem_write[memory][i];
+                mmio->mem_write[idx][i] = io_mem_write[memory][i];
                 mmio->opaque[idx][1][i] = io_mem_opaque[memory];
                 mmio->region_offset[idx][1][i] = region_offset;
             }

      reply	other threads:[~2009-02-20 20:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 18:11 [Qemu-devel] [PATCH] exec.c remove unnecessary operators on functions Robert Reif
2009-02-20 20:37 ` Robert Reif [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=499F1492.5080602@earthlink.net \
    --to=reif@earthlink.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.