On Mon, Jun 20, 2016 at 04:06:42PM +0000, Fabien Siron wrote: > This commit introduces a new type iov_decode which will be used instead > of the integer "decode" as a parameter. > > * defs.h (iov_decode): New enum. > (tprint_iov, tprint_iov_upto): Change type of "decode_iov" to enum iov_decode. > * aio.c (print_iocb): Change type of "decode_iov" to enum iov_decode in > tprint_iov() call. > * keyctl.c (keyctl_instantiate_key_iov): Likewise. > * process.c (ptrace): Likewise. > * process_vm.c (process_vm_readv, process_vm_writev): Likewise. > * io.c (writev, do_pwritev, vmsplice): Likewise. > (print_iovec): Replace the condition with a switch. > (tprint_iov_upto): Change type of "decode_iov" to enum iov_decode. > (readv, do_preadv): Change type of "decode_iov" to enum iov_decode in > tprint_iov_upto() call. > * scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req, > print_sg_io_v4_res): Likewise.
net.c is missing
> ---
> aio.c | 4 +++-
> defs.h | 10 ++++++++--
> io.c | 42 +++++++++++++++++++++++++-----------------
> keyctl.c | 2 +-
> net.c | 3 ++-
> process.c | 4 ++--
> process_vm.c | 10 ++++++----
> scsi.c | 10 ++++++----
> 8 files changed, 53 insertions(+), 32 deletions(-)
[...]
> @@ -79,14 +79,21 @@ print_iovec(struct tcb *tcp, void *elem_buf, size_t
> elem_size, void *data)
>
> tprints("{");
>
> - if (c->decode_iov) {
> - unsigned long len = iov[1];
> - if (len > c->data_size)
> - len = c->data_size;
> - c->data_size -= len;
> - printstr(tcp, iov[0], len);
> - } else {
> - printaddr(iov[0]);
> + switch (c->decode_iov) {
> + case IOV_DECODE_STR:
> + {
> + unsigned long len = iov[1];
> + if (len > c->data_size)
> + len = c->data_size;
> + c->data_size -= len;
> + printstr(tcp, iov[0], len);
> + break;
> + }
As there is going to be another case similar to IOV_DECODE_STR,
let's move initialization of "unsigned long len" out of the switch
statement.
> + default:
> + {
> + printaddr(iov[0]);
> + break;
> + }
These braces are redundant.
--
ldv
pgpHMIbVvQsJ0.pgp
Description: PGP signature
------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape
_______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
