Re: [PATCH v2 1/5] tools/perf,tools/lib/traceevent: Make traceevent APIs more consistent

From: Steven Rostedt
Date: Wed Mar 27 2019 - 10:41:54 EST


On Wed, 27 Mar 2019 16:19:42 +0200
Tzvetomir Stoyanov <tstoyanov@xxxxxxxxxx> 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;
> }
>