RE: [PATCH 1/3] perf alias: Remove trailing newline when reading sysfs files

2018-06-15 Thread David Laight
From: Paul Clarke > Sent: 14 June 2018 14:18 ... > > + /* Remove trailing newline from sysfs file */ > > + cp = strrchr(buf, '\n'); > > + if (cp) > > + *cp = '\0'; > > A nit, perhaps, but this will search backwards through the entire string if a > newline is not found, > which is

Re: [PATCH 1/3] perf alias: Remove trailing newline when reading sysfs files

2018-06-14 Thread Arnaldo Carvalho de Melo
Em Thu, Jun 14, 2018 at 01:48:43PM +0200, Thomas Richter escreveu: > Remove a trailing newline when reading sysfs file contents > + /* Remove trailing newline from sysfs file */ > + cp = strrchr(buf, '\n'); > + if (cp) > + *cp = '\0'; > + We have rtrim() - Arnaldo

Re: [PATCH 1/3] perf alias: Remove trailing newline when reading sysfs files

2018-06-14 Thread Thomas-Mich Richter
On 06/14/2018 03:17 PM, Paul Clarke wrote: > On 06/14/2018 06:48 AM, Thomas Richter wrote: >> Remove a trailing newline when reading sysfs file contents >> such as /sys/devices/cpum_cf/events/TX_NC_TEND. >> This show when verbose option -v is used. >> >> Output before: >> tx_nc_tend -> 'cpum_cf'/'e

Re: [PATCH 1/3] perf alias: Remove trailing newline when reading sysfs files

2018-06-14 Thread Paul Clarke
On 06/14/2018 06:48 AM, Thomas Richter wrote: > Remove a trailing newline when reading sysfs file contents > such as /sys/devices/cpum_cf/events/TX_NC_TEND. > This show when verbose option -v is used. > > Output before: > tx_nc_tend -> 'cpum_cf'/'event=0x008d > '/ > > Output after: > tx_nc_tend -

[PATCH 1/3] perf alias: Remove trailing newline when reading sysfs files

2018-06-14 Thread Thomas Richter
Remove a trailing newline when reading sysfs file contents such as /sys/devices/cpum_cf/events/TX_NC_TEND. This show when verbose option -v is used. Output before: tx_nc_tend -> 'cpum_cf'/'event=0x008d '/ Output after: tx_nc_tend -> 'cpum_cf'/'event=0x8d'/ Signed-off-by: Thomas Richter --- too