diff options
author | Heikki Kallasjoki <fis@zem.fi> | 2018-12-07 02:12:32 +0000 |
---|---|---|
committer | Heikki Kallasjoki <fis+github@zem.fi> | 2018-12-07 02:17:55 +0000 |
commit | 7ec8aa9fcfba92019f537cd19dac4ce15674ddd6 (patch) | |
tree | edfdfcb09dd20e54f9cd4742346c1bf8a45e60d2 /hwmon.c | |
parent | 16d61af28bcd07348117fd457b62ff39c1a0b45d (diff) | |
download | nano-exporter-7ec8aa9fcfba92019f537cd19dac4ce15674ddd6.tar.gz nano-exporter-7ec8aa9fcfba92019f537cd19dac4ce15674ddd6.tar.xz nano-exporter-7ec8aa9fcfba92019f537cd19dac4ce15674ddd6.zip |
Use a struct type for metric labels.
Resolves #4. The real readability benefits are for test code, which will follow up in due course.
Diffstat (limited to 'hwmon.c')
-rw-r--r-- | hwmon.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hwmon.c b/hwmon.c index 896122c..43e9cd0 100644 --- a/hwmon.c +++ b/hwmon.c @@ -190,10 +190,10 @@ static void hwmon_collect(scrape_req *req, void *ctx) { char chip_label[LABEL_SIZE]; char sensor_label[LABEL_SIZE]; - const char *labels[][2] = { - { "chip", chip_label }, - { "sensor", sensor_label }, - { 0, 0 }, + struct label labels[] = { + { .key = "chip", .value = chip_label }, + { .key = "sensor", .value = sensor_label }, + LABEL_END, }; char path[BUF_SIZE]; |