Skip to contentSkip to conversation

intel_cpus.cpp: Change open parameter to const char *

PATCH Applied Rosen Penev 2 participants 2 messages Mar 31, 2019 – Apr 1, 2019

lore
Share & tools
lore

Rosen Penev

author
#0 lore raw

PATCH 1/1 intel_cpus.cpp: Change open parameter to const char *

ifstream::open takes std::string starting with C++11, not before.

This fixes compilation with uClibc++ and potentially other older libraries

Signed-off-by Rosen Penev <rosenp(a)gmail.com>
---
 src/cpu/intel_cpus.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/cpu/intel_cpus.cpp +1 -1
index 0030dba..4dffadc 100644
@@ -92,7 +92,7 @@ int is_supported_intel_cpu(int model, int cpu)
 
 int is_intel_pstate_driver_loaded()
 {
-	const string filename("/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver");
+	const char *filename = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver";
 	const string intel_pstate("intel_pstate");
 	char line[32] = { '\0' };
 	ifstream file;
Signature · 1 line
2.17.1
Applied
#1 lore raw

Thanks, Applied!

Quoted 39 lines

-----Original Message-----
From: PowerTop [mailto:powertop-bounces(a)lists.01.org] On Behalf Of Rosen Penev
Sent: Saturday, March 30, 2019 8:22 PM
To: powertop(a)lists.01.org
Subject: [Powertop] [PATCH] intel_cpus.cpp: Change open parameter to const char *

ifstream::open takes std::string starting with C++11, not before.

This fixes compilation with uClibc++ and potentially other older libraries

Signed-off-by Rosen Penev <rosenp(a)gmail.com>
---
 src/cpu/intel_cpus.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/cpu/intel_cpus.cpp index renamed from src/cpu/intel_cpus.cpp +0 -0

0030dba..4dffadc 100644

src/cpu/intel_cpus.cpp +2 -2
@@ -92,7 +92,7 @@ int is_supported_intel_cpu(int model, int cpu)
 
 int is_intel_pstate_driver_loaded()
 {
-	const string
 filename("/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver");
+	const char *filename =
+"/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver";
 	const string intel_pstate("intel_pstate");
 	char line[32] = { '\0' };
 	ifstream file;
--

2.17.1

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop