]> sigrok.org Git - libsigrok.git/commitdiff
fluke-dmm: Declare tables as constants
authorAndreas Sandberg <redacted>
Sun, 13 Oct 2024 15:52:04 +0000 (16:52 +0100)
committerSoeren Apel <redacted>
Sun, 9 Nov 2025 22:38:00 +0000 (23:38 +0100)
There is no need to modify the various lookup tables at
runtime. Declare these as const to avoid surprises.

Signed-off-by: Andreas Sandberg <redacted>
src/hardware/fluke-dmm/fluke-28x.c

index ec8678dcb0962bc789f937452f3cc0c425686511..e4383fbeeb70905c523a8d05edbb7472a4530b9b 100644 (file)
@@ -41,7 +41,7 @@ struct state_mapping {
        enum measurement_state state;
 };
 
-static struct state_mapping state_map[] = {
+static const struct state_mapping state_map[] = {
        { "INVALID", MEAS_S_INVALID },
        { "NORMAL", MEAS_S_NORMAL },
        { "BLANK", MEAS_S_BLANK },
@@ -69,7 +69,7 @@ struct attribute_mapping {
        enum measurement_attribute attribute;
 };
 
-static struct attribute_mapping attribute_map[] = {
+static const struct attribute_mapping attribute_map[] = {
        { "NONE", MEAS_A_NONE },
        { "OPEN_CIRCUIT", MEAS_A_OPEN_CIRCUIT },
        { "SHORT_CIRCUIT", MEAS_A_SHORT_CIRCUIT },
@@ -88,7 +88,7 @@ struct unit_mapping {
        enum sr_mqflag mqflags;
 };
 
-static struct unit_mapping unit_map[] = {
+static const struct unit_mapping unit_map[] = {
        { "VDC", SR_MQ_VOLTAGE, SR_UNIT_VOLT, SR_MQFLAG_DC },
        { "VAC", SR_MQ_VOLTAGE, SR_UNIT_VOLT, SR_MQFLAG_AC | SR_MQFLAG_RMS },
        { "ADC", SR_MQ_CURRENT, SR_UNIT_AMPERE, SR_MQFLAG_DC },