]> git.ipfire.org Git - thirdparty/git.git/commitdiff
global: mark usage strings and string tables const
authorAhelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Mon, 21 Apr 2025 08:56:13 +0000 (10:56 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 22 Apr 2025 04:01:19 +0000 (21:01 -0700)
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 files changed:
builtin/blame.c
builtin/commit-graph.c
builtin/fast-export.c
builtin/mktree.c
builtin/pack-objects.c
builtin/show-branch.c
t/helper/test-bloom.c
t/helper/test-date.c
t/helper/test-find-pack.c
t/helper/test-getcwd.c
t/helper/test-pack-mtimes.c
t/helper/test-proc-receive.c
t/helper/test-rot13-filter.c
t/helper/test-submodule.c
t/helper/test-windows-named-pipe.c

index c470654c7ec2c364c30b28ae2da09e15a0571491..4f994bb0087eff6050a87843744f29fec194fb45 100644 (file)
 #include "tag.h"
 #include "write-or-die.h"
 
-static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>");
-static char annotate_usage[] = N_("git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>");
+static const char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>");
+static const char annotate_usage[] = N_("git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>");
 
-static const char *blame_opt_usage[] = {
+static const char *const blame_opt_usage[] = {
        blame_usage,
        "",
        N_("<rev-opts> are documented in git-rev-list(1)"),
        NULL
 };
 
-static const char *annotate_opt_usage[] = {
+static const char *const annotate_opt_usage[] = {
        annotate_usage,
        "",
        N_("<rev-opts> are documented in git-rev-list(1)"),
@@ -929,7 +929,7 @@ int cmd_blame(int argc,
        long anchor;
        long num_lines = 0;
        const char *str_usage = cmd_is_annotate ? annotate_usage : blame_usage;
-       const char **opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage;
+       const char *const *opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage;
 
        setup_default_color_by_age();
        git_config(git_blame_config, &output_option);
index 8ca75262c59c480a33b53ce9010a882970066957..a1c1af7f3ffe2a8b6c13bfe8f1c1816c873e1b52 100644 (file)
           "                       [--changed-paths] [--[no-]max-new-filters <n>] [--[no-]progress]\n" \
           "                       <split-options>")
 
-static const char * builtin_commit_graph_verify_usage[] = {
+static const char * const builtin_commit_graph_verify_usage[] = {
        BUILTIN_COMMIT_GRAPH_VERIFY_USAGE,
        NULL
 };
 
-static const char * builtin_commit_graph_write_usage[] = {
+static const char * const builtin_commit_graph_write_usage[] = {
        BUILTIN_COMMIT_GRAPH_WRITE_USAGE,
        NULL
 };
index a5c82eef1ded4dae5b4128781868e2c656eedfbd..c61bae97e9f6a36db53fb50342c3202481716059 100644 (file)
@@ -30,7 +30,7 @@
 #include "remote.h"
 #include "blob.h"
 
-static const char *fast_export_usage[] = {
+static const char *const fast_export_usage[] = {
        N_("git fast-export [<rev-list-opts>]"),
        NULL
 };
index 3c16faa40e38107662100a8565d179723bc2aeea..22486963afd6a36087875095e280abeadcf0f821 100644 (file)
@@ -66,7 +66,7 @@ static void write_tree(struct object_id *oid)
        strbuf_release(&buf);
 }
 
-static const char *mktree_usage[] = {
+static const char *const mktree_usage[] = {
        "git mktree [-z] [--missing] [--batch]",
        NULL
 };
index 58a9b1612626e0fca9c403b5ed9744d80757227e..68a249c1111ff057fd006030f67683696603c894 100644 (file)
@@ -183,7 +183,7 @@ static inline void oe_set_delta_size(struct packing_data *pack,
 #define SET_DELTA_CHILD(obj, val) oe_set_delta_child(&to_pack, obj, val)
 #define SET_DELTA_SIBLING(obj, val) oe_set_delta_sibling(&to_pack, obj, val)
 
-static const char *pack_usage[] = {
+static const char *const pack_usage[] = {
        N_("git pack-objects --stdout [<options>] [< <ref-list> | < <object-list>]"),
        N_("git pack-objects [<options>] <base-name> [< <ref-list> | < <object-list>]"),
        NULL
index fce6b404e9265baafb4f173d2adad414b24984de..c74b4df7ec5fe6fba5b743b4e03098758a6dc9d7 100644 (file)
@@ -19,7 +19,7 @@
 #include "date.h"
 #include "wildmatch.h"
 
-static const char* show_branch_usage[] = {
+static const char*const show_branch_usage[] = {
     N_("git show-branch [-a | --all] [-r | --remotes] [--topo-order | --date-order]\n"
        "                [--current] [--color[=<when>] | --no-color] [--sparse]\n"
        "                [--more=<n> | --list | --independent | --merge-base]\n"
index 14e075c1a11a4e06f111df4d410f0a11354ea4b8..9aa2c5a5926d47dd798e99265af0498eafe817f0 100644 (file)
@@ -44,7 +44,7 @@ static void get_bloom_filter_for_commit(const struct object_id *commit_oid)
        print_bloom_filter(filter);
 }
 
-static const char *bloom_usage = "\n"
+static const char *const bloom_usage = "\n"
 "  test-tool bloom get_murmur3 <string>\n"
 "  test-tool bloom get_murmur3_seven_highbit\n"
 "  test-tool bloom generate_filter <string> [<string>...]\n"
index f25512de9a465b276539f0177d2ec4807707de58..87d2ad6fca170ee37aa44526010f6e083f4eba3c 100644 (file)
@@ -2,7 +2,7 @@
 #include "date.h"
 #include "trace.h"
 
-static const char *usage_msg = "\n"
+static const char *const usage_msg = "\n"
 "  test-tool date relative [time_t]...\n"
 "  test-tool date human [time_t]...\n"
 "  test-tool date show:<format> [time_t]...\n"
index 85a69a4e557694c41e042f10a461587a987de99e..76c2f4eba85f2ccdf3e9b53caec8b7a353b20a19 100644 (file)
@@ -15,7 +15,7 @@
  * packfiles containing the object is not <n>.
  */
 
-static const char *find_pack_usage[] = {
+static const char *const find_pack_usage[] = {
        "test-tool find-pack [--check-count <n>] <object>",
        NULL
 };
index d680038a780079db9abadc5fe95967aebd43abc8..cd4d42407965a33c062137f6b63db7341a5eb120 100644 (file)
@@ -2,7 +2,7 @@
 #include "git-compat-util.h"
 #include "parse-options.h"
 
-static const char *getcwd_usage[] = {
+static const char *const getcwd_usage[] = {
        "test-tool getcwd",
        NULL
 };
index f8f9afbb5b1f57b09abf41359dbeb5e418343ab8..fb8d919f6b5b49f35628d0445b3dacf6a867aa09 100644 (file)
@@ -24,7 +24,7 @@ static void dump_mtimes(struct packed_git *p)
        }
 }
 
-static const char *pack_mtimes_usage = "\n"
+static const char *const pack_mtimes_usage = "\n"
 "  test-tool pack-mtimes <pack-name.mtimes>";
 
 int cmd__pack_mtimes(int argc, const char **argv)
index 3703f734f3b125e1fc78d27678199f37d1af3a54..8eccc34216c6762040defb651a6afc522a06d984 100644 (file)
@@ -6,7 +6,7 @@
 #include "sigchain.h"
 #include "string-list.h"
 
-static const char *proc_receive_usage[] = {
+static const char *const proc_receive_usage[] = {
        "test-tool proc-receive [<options>]",
        NULL
 };
index 722b1cbe7788bc926b94340feb600502825b3886..ad37e1003445aa18257c626d571d85658974a678 100644 (file)
@@ -324,7 +324,7 @@ static void packet_initialize(void)
        packet_flush(1);
 }
 
-static const char *rot13_usage[] = {
+static const char *const rot13_usage[] = {
        "test-tool rot13-filter [--always-delay] --log=<path> <capabilities>",
        NULL
 };
index 22e518d22905261fbc735383fd443e06ce7c203b..0133852e1ebfc7fa2ff3f4368133568bbd93072d 100644 (file)
 
 #define TEST_TOOL_CHECK_NAME_USAGE \
        "test-tool submodule check-name"
-static const char *submodule_check_name_usage[] = {
+static const char *const submodule_check_name_usage[] = {
        TEST_TOOL_CHECK_NAME_USAGE,
        NULL
 };
 
 #define TEST_TOOL_CHECK_URL_USAGE \
        "test-tool submodule check-url"
-static const char *submodule_check_url_usage[] = {
+static const char *const submodule_check_url_usage[] = {
        TEST_TOOL_CHECK_URL_USAGE,
        NULL
 };
 
 #define TEST_TOOL_IS_ACTIVE_USAGE \
        "test-tool submodule is-active <name>"
-static const char *submodule_is_active_usage[] = {
+static const char *const submodule_is_active_usage[] = {
        TEST_TOOL_IS_ACTIVE_USAGE,
        NULL
 };
 
 #define TEST_TOOL_RESOLVE_RELATIVE_URL_USAGE \
        "test-tool submodule resolve-relative-url <up_path> <remoteurl> <url>"
-static const char *submodule_resolve_relative_url_usage[] = {
+static const char *const submodule_resolve_relative_url_usage[] = {
        TEST_TOOL_RESOLVE_RELATIVE_URL_USAGE,
        NULL,
 };
 
-static const char *submodule_usage[] = {
+static const char *const submodule_usage[] = {
        TEST_TOOL_CHECK_NAME_USAGE,
        TEST_TOOL_CHECK_URL_USAGE,
        TEST_TOOL_IS_ACTIVE_USAGE,
index ae52183e634425321ce11731804c5d0bb1bebee4..bd73784cebb3a56df59345eefcba732b635f9580 100644 (file)
@@ -3,7 +3,7 @@
 #include "strbuf.h"
 
 #ifdef GIT_WINDOWS_NATIVE
-static const char *usage_string = "<pipe-filename>";
+static const char *const usage_string = "<pipe-filename>";
 
 #define TEST_BUFSIZE (4096)