]> granicus.if.org Git - strace/commitdiff
Change last parameter of umoven() from char* to void*
authorDenys Vlasenko <dvlasenk@redhat.com>
Sat, 21 Mar 2015 18:50:53 +0000 (19:50 +0100)
committerDenys Vlasenko <dvlasenk@redhat.com>
Sat, 21 Mar 2015 18:50:53 +0000 (19:50 +0100)
Saves tons of casts.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
17 files changed:
capability.c
defs.h
desc.c
io.c
kexec.c
mem.c
net.c
pathtrace.c
scsi.c
sigreturn.c
sock.c
stream.c
syscall.c
sysctl.c
uid.c
util.c
utime.c

index bbd5544afefb509e7a789a2737af161068b1a936..26d9c66aaad55c0a71ca18b4e35bd2683ffe797d 100644 (file)
@@ -103,7 +103,7 @@ print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
        else
                len = 1;
 
-       if (umoven(tcp, addr, len * sizeof(data[0]), (char *) data) < 0) {
+       if (umoven(tcp, addr, len * sizeof(data[0]), data) < 0) {
                tprintf("%#lx", addr);
                return;
        }
diff --git a/defs.h b/defs.h
index 14e46535b0a502b0a0eaa57c1cad14718b0a1093..4f6bbd960320c782e860f1d21efa427dc2d14dcc 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -419,9 +419,9 @@ extern void clear_regs(void);
 extern void get_regs(pid_t pid);
 extern int get_scno(struct tcb *tcp);
 
-extern int umoven(struct tcb *, long, unsigned int, char *);
+extern int umoven(struct tcb *, long, unsigned int, void *);
 #define umove(pid, addr, objp) \
-       umoven((pid), (addr), sizeof(*(objp)), (char *) (objp))
+       umoven((pid), (addr), sizeof(*(objp)), (void *) (objp))
 extern int umovestr(struct tcb *, long, unsigned int, char *);
 extern int upeek(int pid, long, long *);
 #if defined(SPARC) || defined(SPARC64) || defined(IA64) || defined(SH)
diff --git a/desc.c b/desc.c
index 24de51deddfc32f5ea39fc1215bec42d6c5dcbb6..485c802b9d344972d886b4322ddee45392b7aeb1 100644 (file)
--- a/desc.c
+++ b/desc.c
@@ -353,7 +353,7 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
                                tprintf(", %#lx", arg);
                                continue;
                        }
-                       if (umoven(tcp, arg, fdsize, (char *) fds) < 0) {
+                       if (umoven(tcp, arg, fdsize, fds) < 0) {
                                tprints(", [?]");
                                continue;
                        }
@@ -397,7 +397,7 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
                        int first = 1;
 
                        arg = args[i+1];
-                       if (!arg || umoven(tcp, arg, fdsize, (char *) fds) < 0)
+                       if (!arg || umoven(tcp, arg, fdsize, fds) < 0)
                                continue;
                        for (j = 0;; j++) {
                                j = next_set_bit(fds, j, nfds);
@@ -445,7 +445,7 @@ sys_oldselect(struct tcb *tcp)
 {
        long args[5];
 
-       if (umoven(tcp, tcp->u_arg[0], sizeof args, (char *) args) < 0) {
+       if (umoven(tcp, tcp->u_arg[0], sizeof args, args) < 0) {
                tprints("[...]");
                return 0;
        }
diff --git a/io.c b/io.c
index 3626c77633e87abd3b00ef8ffb2bf69125d9e794..06185096219b736101350b082fc684c4faca51a1 100644 (file)
--- a/io.c
+++ b/io.c
@@ -112,7 +112,7 @@ tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr, int deco
                        tprints("...");
                        break;
                }
-               if (umoven(tcp, cur, sizeof_iov, (char *) &iov) < 0) {
+               if (umoven(tcp, cur, sizeof_iov, &iov) < 0) {
                        tprints("?");
                        failed = 1;
                        break;
diff --git a/kexec.c b/kexec.c
index e277668d62e25c1d24eae2fb891c610eebee0286..6bec51c9837581d60f3b73cc32c094346840f90e 100644 (file)
--- a/kexec.c
+++ b/kexec.c
@@ -58,8 +58,7 @@ print_kexec_segments(struct tcb *tcp, unsigned long addr, unsigned long len)
        for (i = 0; i < len; ++i) {
                if (i)
                        tprints(", ");
-               if (umoven(tcp, addr + i * sizeof_seg, sizeof_seg,
-                          (char *) &seg) < 0) {
+               if (umoven(tcp, addr + i * sizeof_seg, sizeof_seg, &seg) < 0) {
                        tprints("?");
                        failed = 1;
                        break;
diff --git a/mem.c b/mem.c
index 5e1822fb528b3d14c7ecaf38ca7b8b57ec56dc23..41d90ec82d8d415f6664a84a4af9f86793c0b077 100644 (file)
--- a/mem.c
+++ b/mem.c
@@ -106,7 +106,7 @@ sys_old_mmap(struct tcb *tcp)
         */
        int i;
        unsigned narrow_arg[6];
-       if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), (char *) narrow_arg) == -1)
+       if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
                return 0;
        for (i = 0; i < 6; i++)
                u_arg[i] = (unsigned long) narrow_arg[i];
@@ -114,12 +114,12 @@ sys_old_mmap(struct tcb *tcp)
        /* We are here only in personality 1 (i386) */
        int i;
        unsigned narrow_arg[6];
-       if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), (char *) narrow_arg) == -1)
+       if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
                return 0;
        for (i = 0; i < 6; ++i)
                u_arg[i] = (unsigned long) narrow_arg[i];
 #else
-       if (umoven(tcp, tcp->u_arg[0], sizeof(u_arg), (char *) u_arg) == -1)
+       if (umoven(tcp, tcp->u_arg[0], sizeof(u_arg), u_arg) == -1)
                return 0;
 #endif
        return print_mmap(tcp, u_arg, (unsigned long) u_arg[5]);
@@ -134,7 +134,7 @@ sys_old_mmap_pgoff(struct tcb *tcp)
        int i;
        unsigned narrow_arg[6];
        unsigned long long offset;
-       if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), (char *) narrow_arg) == -1)
+       if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1)
                return 0;
        for (i = 0; i < 5; i++)
                u_arg[i] = (unsigned long) narrow_arg[i];
@@ -362,7 +362,7 @@ get_nodes(struct tcb *tcp, unsigned long ptr, unsigned long maxnodes, int err)
                                tprints("...");
                                break;
                        }
-                       if (umoven(tcp, cur, sizeof(n), (char *) &n) < 0) {
+                       if (umoven(tcp, cur, sizeof(n), &n) < 0) {
                                tprints("?");
                                failed = 1;
                                break;
diff --git a/net.c b/net.c
index cb29faad6204de8e5a6f56f8e889b34376a5a9bc..276fc60798030b6123c995287dae7dd466b06298 100644 (file)
--- a/net.c
+++ b/net.c
@@ -1071,7 +1071,7 @@ do_pipe(struct tcb *tcp, int flags_arg)
 #if !defined(SPARC) && !defined(SPARC64) && !defined(SH) && !defined(IA64)
                        int fds[2];
 
-                       if (umoven(tcp, tcp->u_arg[0], sizeof fds, (char *) fds) < 0)
+                       if (umoven(tcp, tcp->u_arg[0], sizeof fds, fds) < 0)
                                tprints("[...]");
                        else
                                tprintf("[%u, %u]", fds[0], fds[1]);
@@ -1116,7 +1116,7 @@ sys_socketpair(struct tcb *tcp)
                        tprintf(", %#lx", tcp->u_arg[3]);
                        return 0;
                }
-               if (umoven(tcp, tcp->u_arg[3], sizeof fds, (char *) fds) < 0)
+               if (umoven(tcp, tcp->u_arg[3], sizeof fds, fds) < 0)
                        tprints(", [...]");
                else
                        tprintf(", [%u, %u]", fds[0], fds[1]);
index 28fc7c9ad8773c82c16bcc206a4514da922b6ec3..0db7fe31d9a31e9e666223bbaecbf2faadfc9530 100644 (file)
@@ -270,7 +270,7 @@ pathtrace_match(struct tcb *tcp)
                args = tcp->u_arg;
                if (s->sys_func == sys_oldselect) {
                        if (umoven(tcp, tcp->u_arg[0], sizeof oldargs,
-                                  (char*) oldargs) < 0)
+                                  oldargs) < 0)
                        {
                                fprintf(stderr, "umoven() failed\n");
                                return 0;
@@ -294,7 +294,7 @@ pathtrace_match(struct tcb *tcp)
                for (i = 1; i <= 3; ++i) {
                        if (args[i] == 0)
                                continue;
-                       if (umoven(tcp, args[i], fdsize, (char *) fds) < 0) {
+                       if (umoven(tcp, args[i], fdsize, fds) < 0) {
                                fprintf(stderr, "umoven() failed\n");
                                continue;
                        }
@@ -328,7 +328,7 @@ pathtrace_match(struct tcb *tcp)
                        return 0;
 
                for (cur = start; cur < end; cur += sizeof(fds))
-                       if ((umoven(tcp, cur, sizeof fds, (char *) &fds) == 0)
+                       if ((umoven(tcp, cur, sizeof fds, &fds) == 0)
                            && fdmatch(tcp, fds.fd))
                                return 1;
 
diff --git a/scsi.c b/scsi.c
index 867b74c01217ad4bfdc7b1c044bccdb87d0391e1..73c97eaca0ebed20e61f8b6b5ac97ab7b748c100 100644 (file)
--- a/scsi.c
+++ b/scsi.c
@@ -53,7 +53,7 @@ print_sg_io_buffer(struct tcb *tcp, unsigned long addr, const unsigned int len)
                goto out;
        allocated = (len > max_strlen) ? max_strlen : len;
        if ((buf = malloc(allocated)) == NULL ||
-           umoven(tcp, addr, allocated, (char *) buf) < 0) {
+           umoven(tcp, addr, allocated, buf) < 0) {
                tprintf("%#lx", addr);
                goto out;
        }
index 365ef1ab0be57ab4eba3edd262f275696bb47c04..7a0dc0620813e2529df022497a8fc466a22f481e 100644 (file)
@@ -138,7 +138,7 @@ sys_sigreturn(struct tcb *tcp)
                /* Fetch remaining words of signal mask, located
                   immediately before.  */
                addr -= sizeof(mask) - sizeof(long);
-               if (umoven(tcp, addr, sizeof(mask) - sizeof(long), (char *) &mask[1]) < 0)
+               if (umoven(tcp, addr, sizeof(mask) - sizeof(long), &mask[1]) < 0)
                        return 0;
                tprints("{mask=");
                tprintsigmask_addr("", mask);
diff --git a/sock.c b/sock.c
index b6fc95c51d0dcfff20f22be12cc39f8df4c90237..dc8febc11d8c6cf40d1c7d713967d9d3b1d62a95 100644 (file)
--- a/sock.c
+++ b/sock.c
@@ -256,7 +256,7 @@ sock_ioctl(struct tcb *tcp, const unsigned int code, long arg)
                        struct ifreq ifra[nifra];
 
                        if (umoven(tcp, (unsigned long) ifc.ifc_buf,
-                               sizeof(ifra), (char *) ifra) < 0) {
+                               sizeof(ifra), ifra) < 0) {
                                tprintf("%lx}", (unsigned long) ifc.ifc_buf);
                                return 1;
                        }
index 2aa6366c45f4825debd9606432dfb2661d84a97b..3ebbfb731755bbca79351360ef1a17491fbfdb4e 100644 (file)
--- a/stream.c
+++ b/stream.c
@@ -263,7 +263,7 @@ decode_poll(struct tcb *tcp, long pts)
                                tprints("...");
                                break;
                        }
-                       if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
+                       if (umoven(tcp, cur, sizeof fds, &fds) < 0) {
                                tprints("?");
                                failed = 1;
                                break;
@@ -313,7 +313,7 @@ decode_poll(struct tcb *tcp, long pts)
                outptr = outstr;
 
                for (cur = start; cur < end; cur += sizeof(fds)) {
-                       if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
+                       if (umoven(tcp, cur, sizeof fds, &fds) < 0) {
                                if (outptr < end_outstr - 2)
                                        *outptr++ = '?';
                                failed = 1;
index 33b22ecc3d56b5f14f33061fe11f22cebe12ca9a..e981a68cf43f6a5adcd81482637b8a6e4dfb3f98 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -1559,7 +1559,7 @@ get_syscall_args(struct tcb *tcp)
 
                for (i = 0; i < nargs; ++i) {
                        if (umoven(tcp, (unsigned long) ia64_rse_skip_regs(out0, i),
-                                  sizeof(long), (char *) &tcp->u_arg[i]) < 0)
+                                  sizeof(long), &tcp->u_arg[i]) < 0)
                                return -1;
                }
        } else {
@@ -1601,7 +1601,7 @@ get_syscall_args(struct tcb *tcp)
        if (nargs > 4) {
                umoven(tcp, mips_REG_SP + 4 * 4,
                       (nargs - 4) * sizeof(tcp->u_arg[0]),
-                      (char *)(tcp->u_arg + 4));
+                      &tcp->u_arg[4]);
        }
 #elif defined(POWERPC)
        (void)i;
index 70cc5d9a5250b7334a6069324813e076ec79c95a..a550edae876f1bf65358383b510fe5b5cc7cdbca 100644 (file)
--- a/sysctl.c
+++ b/sysctl.c
@@ -27,7 +27,7 @@ sys_sysctl(struct tcb *tcp)
        size = sizeof(int) * (unsigned long) info.nlen;
        name = (size / sizeof(int) != (unsigned long) info.nlen) ? NULL : malloc(size);
        if (name == NULL ||
-           umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) {
+           umoven(tcp, (unsigned long) info.name, size, name) < 0) {
                free(name);
                if (entering(tcp))
                        tprintf("{%p, %d, %p, %p, %p, %lu}",
diff --git a/uid.c b/uid.c
index 1f8c365704551f61a81eb22a268b54fc122d34c7..96b3d38f5e86307cbd4789d71564e685d5a0c285 100644 (file)
--- a/uid.c
+++ b/uid.c
@@ -183,7 +183,7 @@ sys_setgroups(struct tcb *tcp)
                                tprints("...");
                                break;
                        }
-                       if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
+                       if (umoven(tcp, cur, sizeof(gid), &gid) < 0) {
                                tprints("?");
                                failed = 1;
                                break;
@@ -242,7 +242,7 @@ sys_getgroups(struct tcb *tcp)
                                tprints("...");
                                break;
                        }
-                       if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
+                       if (umoven(tcp, cur, sizeof(gid), &gid) < 0) {
                                tprints("?");
                                failed = 1;
                                break;
diff --git a/util.c b/util.c
index 02c5b9aa4f850eaa67cb1f134e0d8248939bbcb8..fd9053a529c5cd1d03b458b621692e30d18961a2 100644 (file)
--- a/util.c
+++ b/util.c
@@ -835,7 +835,7 @@ dumpiov(struct tcb *tcp, int len, long addr)
                fprintf(stderr, "Out of memory\n");
                return;
        }
-       if (umoven(tcp, addr, size, (char *) iov) >= 0) {
+       if (umoven(tcp, addr, size, iov) >= 0) {
                for (i = 0; i < len; i++) {
                        /* include the buffer number to make it easy to
                         * match up the trace with the source */
@@ -881,7 +881,7 @@ dumpstr(struct tcb *tcp, long addr, int len)
                strsize = len + 16;
        }
 
-       if (umoven(tcp, addr, len, (char *) str) < 0)
+       if (umoven(tcp, addr, len, str) < 0)
                return;
 
        /* Space-pad to 16 bytes */
@@ -966,11 +966,12 @@ static bool process_vm_readv_not_supported = 1;
 #define PAGMASK        (~(PAGSIZ - 1))
 /*
  * move `len' bytes of data from process `pid'
- * at address `addr' to our space at `laddr'
+ * at address `addr' to our space at `our_addr'
  */
 int
-umoven(struct tcb *tcp, long addr, unsigned int len, char *laddr)
+umoven(struct tcb *tcp, long addr, unsigned int len, void *our_addr)
 {
+       char *laddr = our_addr;
        int pid = tcp->pid;
        unsigned int n, m, nread;
        union {
diff --git a/utime.c b/utime.c
index 6e396b05fa93994f9b6fb7702e0260af296c547c..ba2535671ca1f8d7f06c878f79d01cc6ade41142 100644 (file)
--- a/utime.c
+++ b/utime.c
@@ -19,7 +19,7 @@ sys_utime(struct tcb *tcp)
                        tprints("NULL");
                else if (!verbose(tcp))
                        tprintf("%#lx", tcp->u_arg[1]);
-               else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0)
+               else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, &u) < 0)
                        tprints("[?, ?]");
                else if (wordsize == sizeof u.utl[0]) {
                        tprintf("[%s,", sprinttime(u.utl[0]));