commit - b0ca001af3a6f91a192aad01b0c3a8f94f8f6c9f
commit + 641a8ee6368cd932d7b144a7ec45f7a463ae6a0b
blob - d11dbd4e12b8d4a738406f1cd9ee79cd42143355
blob + 6f694410d179bedcd7087ff3a7f6a9d78cff850b
--- got/got.c
+++ got/got.c
static const struct got_error* cmd_cat(int, char *[]);
static const struct got_error* cmd_info(int, char *[]);
-static struct got_cmd got_commands[] = {
+static const struct got_cmd got_commands[] = {
{ "init", cmd_init, usage_init, "" },
{ "import", cmd_import, usage_import, "im" },
{ "clone", cmd_clone, usage_clone, "cl" },
fprintf(fp, "commands:");
for (i = 0; i < nitems(got_commands); i++) {
- struct got_cmd *cmd = &got_commands[i];
+ const struct got_cmd *cmd = &got_commands[i];
fprintf(fp, " %s", cmd->cmd_name);
}
fputc('\n', fp);
int
main(int argc, char *argv[])
{
- struct got_cmd *cmd;
+ const struct got_cmd *cmd;
size_t i;
int ch;
int hflag = 0, Vflag = 0;
- static struct option longopts[] = {
+ static const struct option longopts[] = {
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
continue;
if (hflag)
- got_commands[i].cmd_usage();
+ cmd->cmd_usage();
- error = got_commands[i].cmd_main(argc, argv);
+ error = cmd->cmd_main(argc, argv);
if (error && error->code != GOT_ERR_CANCELLED &&
error->code != GOT_ERR_PRIVSEP_EXIT &&
!(sigpipe_received &&
#define GOT_HISTEDIT_DROP 'd'
#define GOT_HISTEDIT_MESG 'm'
-static struct got_histedit_cmd {
+static const struct got_histedit_cmd {
unsigned char code;
const char *name;
const char *desc;
}
for (i = 0; i < nitems(got_histedit_cmds); i++) {
- struct got_histedit_cmd *cmd = &got_histedit_cmds[i];
+ const struct got_histedit_cmd *cmd = &got_histedit_cmds[i];
n = fprintf(f, "# %s (%c): %s\n", cmd->name, cmd->code,
cmd->desc);
if (n < 0) {
blob - 685896f0638c6b007486f72cbba47e46ddb81a9e
blob + 051b3b2ccf153f05495e9c51607d300846e2b991
--- gotadmin/gotadmin.c
+++ gotadmin/gotadmin.c
static const struct got_error* cmd_listpack(int, char *[]);
static const struct got_error* cmd_cleanup(int, char *[]);
-static struct gotadmin_cmd gotadmin_commands[] = {
+static const struct gotadmin_cmd gotadmin_commands[] = {
{ "info", cmd_info, usage_info, "" },
{ "pack", cmd_pack, usage_pack, "" },
{ "indexpack", cmd_indexpack, usage_indexpack,"ix" },
fprintf(fp, "commands:");
for (i = 0; i < nitems(gotadmin_commands); i++) {
- struct gotadmin_cmd *cmd = &gotadmin_commands[i];
+ const struct gotadmin_cmd *cmd = &gotadmin_commands[i];
fprintf(fp, " %s", cmd->cmd_name);
}
fputc('\n', fp);
int
main(int argc, char *argv[])
{
- struct gotadmin_cmd *cmd;
+ const struct gotadmin_cmd *cmd;
size_t i;
int ch;
int hflag = 0, Vflag = 0;
- static struct option longopts[] = {
+ static const struct option longopts[] = {
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
continue;
if (hflag)
- gotadmin_commands[i].cmd_usage();
+ cmd->cmd_usage();
- error = gotadmin_commands[i].cmd_main(argc, argv);
+ error = cmd->cmd_main(argc, argv);
if (error && error->code != GOT_ERR_CANCELLED &&
error->code != GOT_ERR_PRIVSEP_EXIT &&
!(sigpipe_received &&
blob - bad14df5f39d108c10d4a12d2dfaaf2795ae8c32
blob + a52c4af1a9366a4832e5efcd79cba83fcce4b8dd
--- tog/tog.c
+++ tog/tog.c
static const struct got_error* cmd_tree(int, char *[]);
static const struct got_error* cmd_ref(int, char *[]);
-static struct tog_cmd tog_commands[] = {
+static const struct tog_cmd tog_commands[] = {
{ "log", cmd_log, usage_log },
{ "diff", cmd_diff, usage_diff },
{ "blame", cmd_blame, usage_blame },
fprintf(fp, "commands:");
for (i = 0; i < nitems(tog_commands); i++) {
- struct tog_cmd *cmd = &tog_commands[i];
+ const struct tog_cmd *cmd = &tog_commands[i];
fprintf(fp, " %s", cmd->name);
}
fputc('\n', fp);
tog_log_with_path(int argc, char *argv[])
{
const struct got_error *error = NULL, *close_err;
- struct tog_cmd *cmd = NULL;
+ const struct tog_cmd *cmd = NULL;
struct got_repository *repo = NULL;
struct got_worktree *worktree = NULL;
struct got_object_id *commit_id = NULL, *id = NULL;
main(int argc, char *argv[])
{
const struct got_error *error = NULL;
- struct tog_cmd *cmd = NULL;
+ const struct tog_cmd *cmd = NULL;
int ch, hflag = 0, Vflag = 0;
char **cmd_argv = NULL;
- static struct option longopts[] = {
+ static const struct option longopts[] = {
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0}
};