From: Max Kellermann Date: Mon, 18 Nov 2024 11:33:07 +0000 (+0100) Subject: sys-utils: make pointer arrays const X-Git-Tag: v2.42-start~145^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bf524d96ee145cff1eace2e04125bc0825887890;p=thirdparty%2Futil-linux.git sys-utils: make pointer arrays const --- diff --git a/sys-utils/blkzone.c b/sys-utils/blkzone.c index 9706d615c..843f3c7b0 100644 --- a/sys-utils/blkzone.c +++ b/sys-utils/blkzone.c @@ -207,14 +207,14 @@ done: */ #define DEF_REPORT_LEN (1U << 12) /* 4k zones per report (256k kzalloc) */ -static const char *type_text[] = { +static const char *const type_text[] = { "RESERVED", "CONVENTIONAL", "SEQ_WRITE_REQUIRED", "SEQ_WRITE_PREFERRED", }; -static const char *condition_str[] = { +static const char *const condition_str[] = { "nw", /* Not write pointer */ "em", /* Empty */ "oi", /* Implicitly opened */ diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c index 4e79859c2..57750e9ce 100644 --- a/sys-utils/chmem.c +++ b/sys-utils/chmem.c @@ -67,7 +67,7 @@ enum zone_id { ZONE_DEVICE, }; -static char *zone_names[] = { +static const char *const zone_names[] = { [ZONE_DMA] = "DMA", [ZONE_DMA32] = "DMA32", [ZONE_NORMAL] = "Normal", diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index c5b88e8cc..455bbf4e9 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -36,14 +36,14 @@ #include "lscpu.h" -static const char *virt_types[] = { +static const char *const virt_types[] = { [VIRT_TYPE_NONE] = N_("none"), [VIRT_TYPE_PARA] = N_("para"), [VIRT_TYPE_FULL] = N_("full"), [VIRT_TYPE_CONTAINER] = N_("container"), }; -static const char *hv_vendors[] = { +static const char *const hv_vendors[] = { [VIRT_VENDOR_NONE] = NULL, [VIRT_VENDOR_XEN] = "Xen", [VIRT_VENDOR_KVM] = "KVM", @@ -63,7 +63,7 @@ static const char *hv_vendors[] = { }; /* dispatching modes */ -static const char *disp_modes[] = { +static const char *const disp_modes[] = { [DISP_HORIZONTAL] = N_("horizontal"), [DISP_VERTICAL] = N_("vertical") }; diff --git a/sys-utils/lsmem.c b/sys-utils/lsmem.c index 002f7567e..9ea80cb85 100644 --- a/sys-utils/lsmem.c +++ b/sys-utils/lsmem.c @@ -95,7 +95,7 @@ enum { COL_ZONES, }; -static char *zone_names[] = { +static const char *const zone_names[] = { [ZONE_DMA] = "DMA", [ZONE_DMA32] = "DMA32", [ZONE_NORMAL] = "Normal", diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c index a3ca21fcb..500bc013c 100644 --- a/sys-utils/lsns.c +++ b/sys-utils/lsns.c @@ -141,7 +141,7 @@ enum lsns_type { LSNS_TYPE_TIME }; -static char *ns_names[] = { +static const char *const ns_names[] = { /* Don't add LSNS_TYPE_UNKNOWN here. * ARRAY_SIZE(ns_names) in struct lsns_process may not work.*/ [LSNS_TYPE_MNT] = "mnt", diff --git a/sys-utils/renice.c b/sys-utils/renice.c index a8cf74113..419cef46d 100644 --- a/sys-utils/renice.c +++ b/sys-utils/renice.c @@ -50,7 +50,7 @@ #include "c.h" #include "closestream.h" -static const char *idtype[] = { +static const char *const idtype[] = { [PRIO_PROCESS] = N_("process ID"), [PRIO_PGRP] = N_("process group ID"), [PRIO_USER] = N_("user ID"), diff --git a/sys-utils/rfkill.c b/sys-utils/rfkill.c index 167d3a23a..fcb249208 100644 --- a/sys-utils/rfkill.c +++ b/sys-utils/rfkill.c @@ -100,7 +100,7 @@ enum { ACT_LIST_OLD }; -static char *rfkill_actions[] = { +static const char *const rfkill_actions[] = { [ACT_LIST] = "list", [ACT_HELP] = "help", [ACT_EVENT] = "event", diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c index 67bbf8ae7..aeabead70 100644 --- a/sys-utils/rtcwake.c +++ b/sys-utils/rtcwake.c @@ -75,7 +75,7 @@ enum rtc_modes { /* manual page --mode option explains these. */ }; -static const char *rtcwake_mode_string[] = { +static const char *const rtcwake_mode_string[] = { [OFF_MODE] = "off", [NO_MODE] = "no", [ON_MODE] = "on", diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c index 7603d4f6c..4818c6ce4 100644 --- a/sys-utils/wdctl.c +++ b/sys-utils/wdctl.c @@ -204,8 +204,8 @@ static const struct colinfo *get_column_info(unsigned num) */ static const char *get_default_device(void) { - const char **p; - static const char *devs[] = { + const char *const*p; + static const char *const devs[] = { "/dev/watchdog0", "/dev/watchdog", NULL diff --git a/sys-utils/zramctl.c b/sys-utils/zramctl.c index cc32ab4f6..3c9dd58b0 100644 --- a/sys-utils/zramctl.c +++ b/sys-utils/zramctl.c @@ -99,7 +99,7 @@ enum { MM_NUM_MIGRATED }; -static const char *mm_stat_names[] = { +static const char *const mm_stat_names[] = { [MM_ORIG_DATA_SIZE] = "orig_data_size", [MM_COMPR_DATA_SIZE] = "compr_data_size", [MM_MEM_USED_TOTAL] = "mem_used_total",