]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
report: drop redundant .generate = NULL metric initializers 42842/head
authorLuca Boccassi <luca.boccassi@gmail.com>
Thu, 2 Jul 2026 15:56:20 +0000 (16:56 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 2 Jul 2026 16:01:02 +0000 (17:01 +0100)
The .generate field of MetricFamily defaults to NULL when omitted from a
designated initializer, so spelling it out explicitly on the metric-family
entries (and the field-generating macros) that have no generator of their
own is just noise. Drop it.

src/report/report-basic.c
src/report/report-cgroup.c

index 56f7065c68d316752fae73fd616980e06184456b..cc3cdd8b243a481f49a4a52a6e00d27207545584 100644 (file)
@@ -505,7 +505,6 @@ static int virtualization_generate(const MetricFamily *mf, sd_varlink *link, voi
                 METRIC_IO_SYSTEMD_BASIC_PREFIX "OSRelease." name,       \
                 "Operating system identification (" name "= field from os-release)", \
                 METRIC_FAMILY_TYPE_STRING,                              \
-                .generate = NULL,                                       \
         }
 
 #define MACHINE_INFO_STANDARD_FIELD(name)                               \
@@ -513,7 +512,6 @@ static int virtualization_generate(const MetricFamily *mf, sd_varlink *link, voi
                 METRIC_IO_SYSTEMD_BASIC_PREFIX "MachineInfo." name,     \
                 "Machine identification (" name "= field from machine-info)", \
                 METRIC_FAMILY_TYPE_STRING,                              \
-                .generate = NULL,                                       \
         }
 
 #define SMBIOS_STANDARD_FIELD(name)                                     \
@@ -521,7 +519,6 @@ static int virtualization_generate(const MetricFamily *mf, sd_varlink *link, voi
                 METRIC_IO_SYSTEMD_BASIC_PREFIX "SMBIOS." name,          \
                 "Firmware/hardware identification (" name " field from SMBIOS/DMI)", \
                 METRIC_FAMILY_TYPE_STRING,                              \
-                .generate = NULL,                                       \
         }
 
 static const MetricFamily metric_family_table[] = {
@@ -572,13 +569,11 @@ static const MetricFamily metric_family_table[] = {
                 METRIC_IO_SYSTEMD_BASIC_PREFIX "LoadAverage5Min",
                 "System load average over the last 5 minutes",
                 METRIC_FAMILY_TYPE_GAUGE,
-                .generate = NULL,
         },
         {
                 METRIC_IO_SYSTEMD_BASIC_PREFIX "LoadAverage15Min",
                 "System load average over the last 15 minutes",
                 METRIC_FAMILY_TYPE_GAUGE,
-                .generate = NULL,
         },
         /* Keep those ↑ in sync with load_average_generate(). */
         {
@@ -665,7 +660,6 @@ static const MetricFamily metric_family_table[] = {
                 METRIC_IO_SYSTEMD_BASIC_PREFIX "TPM2.VendorString",
                 "TPM2 device vendor string (ID_TPM2_VENDOR_STRING property of the tpmrm0 device)",
                 METRIC_FAMILY_TYPE_STRING,
-                .generate = NULL,
         },
         /* Keep those ↑ in sync with tpm2_generate(). */
         {
index 240f09f9f2a4f02c11b3c6a62ce0138abfcf8070..94aa0869c45406b80142e2407da8277cdfda9acd 100644 (file)
@@ -370,25 +370,21 @@ static const MetricFamily cgroup_metric_family_table[] = {
                 METRIC_IO_SYSTEMD_CGROUP_PREFIX "IOReadBytes",
                 "Per unit metric: IO bytes read",
                 METRIC_FAMILY_TYPE_COUNTER,
-                .generate = NULL,
         },
         {
                 METRIC_IO_SYSTEMD_CGROUP_PREFIX "IOReadOperations",
                 "Per unit metric: IO read operations",
                 METRIC_FAMILY_TYPE_COUNTER,
-                .generate = NULL,
         },
         {
                 METRIC_IO_SYSTEMD_CGROUP_PREFIX "MemoryUsage",
                 "Per unit metric: memory usage in bytes",
                 METRIC_FAMILY_TYPE_GAUGE,
-                .generate = NULL,
         },
         {
                 METRIC_IO_SYSTEMD_CGROUP_PREFIX "TasksCurrent",
                 "Per unit metric: current number of tasks",
                 METRIC_FAMILY_TYPE_GAUGE,
-                .generate = NULL,
         },
         {}
 };