]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
sys-utils: make pointer arrays const
authorMax Kellermann <max.kellermann@gmail.com>
Mon, 18 Nov 2024 11:33:07 +0000 (12:33 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Mon, 18 Nov 2024 11:35:59 +0000 (12:35 +0100)
sys-utils/blkzone.c
sys-utils/chmem.c
sys-utils/lscpu.c
sys-utils/lsmem.c
sys-utils/lsns.c
sys-utils/renice.c
sys-utils/rfkill.c
sys-utils/rtcwake.c
sys-utils/wdctl.c
sys-utils/zramctl.c

index 9706d615cb5f9a53d95accbf150bef3a6ff459bb..843f3c7b0c3182bb68d987694a69013a86d1298b 100644 (file)
@@ -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 */
index 4e79859c2ee3effd05987517c810f93dfda9465a..57750e9cedee586fed726aa608a7493e19dba99b 100644 (file)
@@ -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",
index c5b88e8cc9e012064b42e4444a7b6c6246c8d480..455bbf4e9116b452912d94e8c0f011a5f0436b18 100644 (file)
 
 #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")
 };
index 002f7567e0f2ac7ffd3e4995a79056402f24a500..9ea80cb857d01ceaf4bba0745239100ce4d292ec 100644 (file)
@@ -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",
index a3ca21fcb28665bcf81efea39ead0223b94ca885..500bc013c44fb36effadf7022364e4a36fc968d2 100644 (file)
@@ -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",
index a8cf7411396828838c3dac9c03c9cd6e00259df0..419cef46d80296fef35ad3ef1c6f6a43a01458e8 100644 (file)
@@ -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"),
index 167d3a23a6a56b0332b8f30ab0e8467ca8c43dc7..fcb249208d14c6b0df0d297edc905742c0f6e084 100644 (file)
@@ -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",
index 67bbf8ae706bc5a4c56572619c4b8249c745cff7..aeabead70b03d61c7d1184efc3c81ff84aa6dee0 100644 (file)
@@ -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",
index 7603d4f6c6000f6e2a1a6b50af50f4335d899087..4818c6ce41075f505953a0765e015004ead82ccd 100644 (file)
@@ -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
index cc32ab4f69c8b9d3dce16125dee9acf55b13e7c3..3c9dd58b07346d47e7f8c50f5ffb4e8a27de9ad9 100644 (file)
@@ -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",