{"thread":{"id":"10612","subject":"[PATCH] Make struct commands[] const to save a couple bytes","startedAt":"2007-11-03T11:13:24Z","lastAt":"2007-11-03T11:13:24Z","messageCount":1,"participants":["Nguyễn Thái Ngọc Duy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"58096","messageId":"20071103111324.GA30441@laptop","threadId":"10612","inReplyTo":null,"subject":"[PATCH] Make struct commands[] const to save a couple bytes","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2007-11-03T11:13:24Z","receivedAt":"2007-11-03T11:13:24Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n .data got reduced by 960 bytes. Not much, but anyway ;)\n\n git.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git.c b/git.c\nindex 4e10581..d0a2042 100644\n--- a/git.c\n+++ b/git.c\n@@ -238,7 +238,7 @@ struct cmd_struct {\n \tint option;\n };\n \n-static int run_command(struct cmd_struct *p, int argc, const char **argv)\n+static int run_command(const struct cmd_struct *p, int argc, const char **argv)\n {\n \tint status;\n \tstruct stat st;\n@@ -283,7 +283,7 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)\n static void handle_internal_command(int argc, const char **argv)\n {\n \tconst char *cmd = argv[0];\n-\tstatic struct cmd_struct commands[] = {\n+\tstatic const struct cmd_struct commands[] = {\n \t\t{ \"add\", cmd_add, RUN_SETUP | NEED_WORK_TREE },\n \t\t{ \"annotate\", cmd_annotate, RUN_SETUP },\n \t\t{ \"apply\", cmd_apply },\n@@ -375,7 +375,7 @@ static void handle_internal_command(int argc, const char **argv)\n \t}\n \n \tfor (i = 0; i < ARRAY_SIZE(commands); i++) {\n-\t\tstruct cmd_struct *p = commands+i;\n+\t\tconst struct cmd_struct *p = commands+i;\n \t\tif (strcmp(p->cmd, cmd))\n \t\t\tcontinue;\n \t\texit(run_command(p, argc, argv));\n-- \n1.5.3.rc4.3.gab089\n"}]}