lkml.org 
[lkml]   [2019]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/5] tools/perf,tools/lib/traceevent: Make traceevent APIs more consistent
On Wed, 27 Mar 2019 16:19:42 +0200
Tzvetomir Stoyanov <tstoyanov@vmware.com> wrote:

> /**
> - * tep_file_bigendian - get if the file is in big endian order
> + * tep_is_file_bigendian - return the endian of the file
> * @pevent: a handle to the tep_handle
> *
> - * This returns if the file is in big endian order
> - * If @pevent is NULL, 0 is returned.
> + * This returns true if the file is in big endian order
> + * If @pevent is NULL, false is returned.
> */
> -int tep_file_bigendian(struct tep_handle *pevent)
> +bool tep_is_file_bigendian(struct tep_handle *pevent)
> {
> if (pevent)
> - return pevent->file_bigendian;
> - return 0;
> + return (pevent->file_bigendian == TEP_BIG_ENDIAN);

One thing I should have mentioned before, is that, when people write
returns like this to the Linux kernel mailing list, you might get a
comment like: "return is not a function, lose the parenthesis".

That is, it should be:

return pevent->file_bigendian == TEP_BIG_ENDIAN;

not

return (pevent->file_bigendian == TEP_BIG_ENDIAN);

If this is the only issue, I may just fix it myself. Just remember that
returns should never have an outside parenthesis.

-- Steve


> + return false;
> }
>

\
 
 \ /
  Last update: 2019-03-27 15:42    [W:0.048 / U:11.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site