chiark / gitweb /
bootchart: use conf-parser & CamelCase names in .conf
[elogind.git] / src / shared / conf-parser.c
index c5dd26db5240d1dcf650e46275f29c1485df3f45..b09e90ae8bd40c672c338b1073f09fa34d6f6819 100644 (file)
@@ -467,6 +467,33 @@ int config_parse_unsigned(
         return 0;
 }
 
         return 0;
 }
 
+int config_parse_double(
+                const char *filename,
+                unsigned line,
+                const char *section,
+                const char *lvalue,
+                int ltype,
+                const char *rvalue,
+                void *data,
+                void *userdata) {
+
+        double *d = data;
+        int r;
+
+        assert(filename);
+        assert(lvalue);
+        assert(rvalue);
+        assert(data);
+
+        r = safe_atod(rvalue, d);
+        if (r < 0) {
+                log_error("[%s:%u] Failed to parse numeric value: %s", filename, line, rvalue);
+                return r;
+        }
+
+        return 0;
+}
+
 int config_parse_bytes_size(
                 const char *filename,
                 unsigned line,
 int config_parse_bytes_size(
                 const char *filename,
                 unsigned line,