commit - e546352ca5c53b183a9f3e39ce7c28db035c8cf4
commit + 3e1665345ba868287dfd11c63dbeb10ce68fb922
blob - d845182619074cecc638ce22a7d9d2752bce380e
blob + 2c02ca33857bec5cf55e156d4e9cb8783514c705
--- 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 - 9bf9bdbfc8e7f58c5245c1b799e93299b67d828f
blob + bd7343dcca754f398aaba30df74ecd27b90d2ee7
--- 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 - 280413b8f66e5256382c5cabb2bf2dc5dbb4bfc5
blob + 162cb7c902a68e5ba42a938f863e0f9846e84b1a
--- 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}
};