Code

battery_statefs: fix a few build warnings
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 2 Dec 2016 13:53:40 +0000 (14:53 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 2 Dec 2016 13:53:40 +0000 (14:53 +0100)
battery_statefs.c:95:8: warning: initializing 'char *' with an expression of type 'const char [38]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
      {STATEFS_ROOT "Current", "current", NULL, 1e-6},        // from uA to A
       ^~~~~~~~~~~~~~~~~~~~~~

src/battery_statefs.c

index 4b9baf4255758792498f154734feec1ce755453a..4f6a8c1567a66353274c9fe7f204d88754c78e83 100644 (file)
@@ -87,9 +87,9 @@ int battery_read_statefs(void) {
   }
 
   struct {
-    char *path;
-    char *type;
-    char *type_instance;
+    const char *path;
+    const char *type;
+    const char *type_instance;
     gauge_t factor;
   } metrics[] = {
       {STATEFS_ROOT "Current", "current", NULL, 1e-6},        // from uA to A