Revert "Deletion of unnecessary checks before specific function calls"

Accidentally committed two patches under the same commit message.  Both
patches will be added immediately after.

This reverts commit fb6f65a01eca950e2e12a87492268e7d2105aa0b.
Deletion of unnecessary checks before calls of the function "free"

The function "free" is documented in the way that no action shall occur for
a passed null pointer. It is therefore not needed that a function caller
repeats a corresponding check.
http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Removal of unnecessary checks before a few calls of the C++ delete operator

The C++ delete operator can also handle passed null pointers on its own
without unexpected side effects.
http://www.parashift.com/c++-faq/delete-handles-null.html

It is therefore not needed to keep additional safety checks directly before
such function calls.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
bug-fix: power estimates

PowerTOP didn’t have a way to inform the user how many runs were needed
to show power estimates when testing battery power. This patch fixes
that problem.  PowerTOP uses a fitness function to approximate the power
estimates, hence the need to have many runs.  The more runs the more
precise the measurements.  For extra precise power measurements use
RAPLE and Power Cap support on Linux kernel.  These features were
released on Linux 3.13.  Latest kernel distributions have RAPLE and
Power Cap enabled.

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
Addition of two include guards

Unique include guards were added to two header files to make their reuse
a bit safer.
https://www.securecoding.cert.org/confluence/display/cplusplus/PRE06-CPP.+Enclose+header+files+in+an+inclusion+guard

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Remove repeated nr_open assignment

The nr_open variable is already initialized to NR_OPEN_DEF.  This patch
removes the redundant checking and assignment for nr_open.

Initialy submited by  Salman Ahmed <salman0yam@gmail.com> However, I
could not get any of his patches appled.

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
bug-fix: Powertop filtered devices

PowerTOP used to show only the devices that had runtime power management
enabled.  This patch allows users to see all PCI and I2C devices on the
system.

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
Changed PowerTOP version 2.6.1 to 2.7

Updated version to 2.7.

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
update powertop.pot file

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
Revert "Properly cleaning up the display tabs"

Produces a segfault on Arch Linux using Clang. Remove for sake of
release.

This reverts commit 706bc28ff536f4f53fdf6e24178b9e3bac67d53f.
Localization changes

This patch adds localization changes generated by Transifex.

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
fix-bug: removed close_display() due to segfault

Clean up function call from removed function definition on previous
patch revert.

Error reported by: Sami Kerola  <kerolasa@iki.fi>

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
bug-fix: added devices/devreq.h to Makefile

This fixes build error on release.

Reported-by: Kristen Carlson Accardi <kristen@linux.intel.com>

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
Update Translation files

Adding generated Transifex files for localization.

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
configure: require new enough automake version

Andreas had build issues with older than 1.11 automake, and it seemed
like 1.11.1 would good required version until Alexandra pointed out that
1.12.2 is needed to be safe from CVE-2012-3386 vulnerability.

Reported-by: Andreas Mohr <andi@lisas.de>
Reported-by: Alexandra Yates <alexandra.yates@linux.intel.com>
Reference: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-3386
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
configure: use autoconf-archive ax_pthread.m4

The configuration script "AX_PTHREAD" was added to the build specification
so that corresponding special parameters will be taken into account.

Reference: http://www.gnu.org/software/autoconf-archive/ax_pthread.html
Reviewed-by: SF Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
add missing space to --version print out

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
csstoh.sh: check every single return value

Earlier the script continued processing at errors.

$ ./csstoh.sh powertop.css /dev/full
./csstoh.sh: line 36: echo: write error: No space left on device
./csstoh.sh: line 37: echo: write error: No space left on device
[...]

Now the script will fail immediately when an error occurs.

$ ./csstoh.sh powertop.css /dev/full ; echo $?
cat: write error: No space left on device
1

As a minor improvement the script now writes errors to stderr rather than
stdout, that is more appropriate.

From https://lists.01.org/pipermail/powertop/2014-November/001686.html

Removal of white space error.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
configure: use AC_USE_SYSTEM_EXTENSIONS to determine features

The AC_USE_SYSTEM_EXTENSIONS will enable everything that a system allows
to be enabled, so there is no longer need for a source file specific
*_SOURCE definitions.  Secondly the uses of _BSD_SOURCE that are removed
in this change are part of deprecated API.  See reference link for
details.

Reference: https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=c941736c92fa3a319221f65f6755659b2a5e0a20
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
move variables to protected scope

This fixes series of issues reported by clang++ compiler the same way.

cpu/rapl/rapl_interface.h:37:6: error: private field
'measurment_interval' is not used [-Werror,-Wunused-private-field]
        int measurment_interval;

The measurment_interval() in relation to first_cpu() is moved to avoid
following compiler warning.

make[3]: Entering directory '/home/src/powertop/src'
  CXX      cpu/rapl/powertop-rapl_interface.o
cpu/rapl/rapl_interface.cpp:78:2: warning: field 'measurment_interval' will be initialized after field 'first_cpu' [-Wreorder]
        measurment_interval(def_sampling_interval),

Signed-off-by: Sami Kerola <kerolasa@iki.fi>