lkml.org 
[lkml]   [2015]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V3 04/25] perf tools: Add AUX area tracing index
On Fri, Apr 24, 2015 at 10:29:46PM +0300, Adrian Hunter wrote:

SNIP

> +
> +int auxtrace_index__process(int fd, u64 size, struct perf_session *session,
> + bool needs_swap)
> +{
> + struct list_head *head = &session->auxtrace_index;
> + u64 nr;
> +
> + if (readn(fd, &nr, sizeof(u64)) != sizeof(u64))
> + return -1;
> +
> + if (needs_swap)
> + nr = bswap_64(nr);
> +
> + if (sizeof(u64) + nr * sizeof(struct auxtrace_index_entry) != size)
> + return -1;

so the total nr is only used to double check the data size is correct,
it could be omited and you could use just the size of the section..
also the auxtrace_index__write would be shorter of one loop

but no big deal.. just asking ;-)

jirka


\
 
 \ /
  Last update: 2015-04-28 14:41    [W:0.248 / U:2.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site