mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
Merge branch 'jk/string-list-static-init'
Instead of taking advantage of a struct string_list that is allocated with all NULs happens to be STRING_LIST_INIT_NODUP kind, initialize them explicitly as such, to document their behaviour better. * jk/string-list-static-init: use string_list initializer consistently blame,shortlog: don't make local option variables static interpret-trailers: don't duplicate option strings parse_opt_string_list: stop allocating new strings
This commit is contained in:
commit
b8b6365a8a
|
@ -4667,6 +4667,9 @@ static void init_apply_state(struct apply_state *state,
|
|||
state->ws_error_action = warn_on_ws_error;
|
||||
state->ws_ignore_action = ignore_ws_none;
|
||||
state->linenr = 1;
|
||||
string_list_init(&state->fn_table, 0);
|
||||
string_list_init(&state->limit_by_name, 0);
|
||||
string_list_init(&state->symlink_changes, 0);
|
||||
strbuf_init(&state->root, 0);
|
||||
|
||||
git_apply_config();
|
||||
|
|
|
@ -56,7 +56,7 @@ static int show_progress;
|
|||
static struct date_mode blame_date_mode = { DATE_ISO8601 };
|
||||
static size_t blame_date_width;
|
||||
|
||||
static struct string_list mailmap;
|
||||
static struct string_list mailmap = STRING_LIST_INIT_NODUP;
|
||||
|
||||
#ifndef DEBUG
|
||||
#define DEBUG 0
|
||||
|
@ -2520,12 +2520,12 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
|
|||
enum object_type type;
|
||||
struct commit *final_commit = NULL;
|
||||
|
||||
static struct string_list range_list;
|
||||
static int output_option = 0, opt = 0;
|
||||
static int show_stats = 0;
|
||||
static const char *revs_file = NULL;
|
||||
static const char *contents_from = NULL;
|
||||
static const struct option options[] = {
|
||||
struct string_list range_list = STRING_LIST_INIT_NODUP;
|
||||
int output_option = 0, opt = 0;
|
||||
int show_stats = 0;
|
||||
const char *revs_file = NULL;
|
||||
const char *contents_from = NULL;
|
||||
const struct option options[] = {
|
||||
OPT_BOOL(0, "incremental", &incremental, N_("Show blame entries as we find them, incrementally")),
|
||||
OPT_BOOL('b', NULL, &blank_boundary, N_("Show blank SHA-1 for boundary commits (Default: off)")),
|
||||
OPT_BOOL(0, "root", &show_root, N_("Do not treat root commits as boundaries (Default: off)")),
|
||||
|
|
|
@ -49,8 +49,8 @@ static char *option_upload_pack = "git-upload-pack";
|
|||
static int option_verbosity;
|
||||
static int option_progress = -1;
|
||||
static enum transport_family family;
|
||||
static struct string_list option_config;
|
||||
static struct string_list option_reference;
|
||||
static struct string_list option_config = STRING_LIST_INIT_NODUP;
|
||||
static struct string_list option_reference = STRING_LIST_INIT_NODUP;
|
||||
static int option_dissociate;
|
||||
static int max_jobs = -1;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ int cmd_interpret_trailers(int argc, const char **argv, const char *prefix)
|
|||
{
|
||||
int in_place = 0;
|
||||
int trim_empty = 0;
|
||||
struct string_list trailers = STRING_LIST_INIT_DUP;
|
||||
struct string_list trailers = STRING_LIST_INIT_NODUP;
|
||||
|
||||
struct option options[] = {
|
||||
OPT_BOOL(0, "in-place", &in_place, N_("edit files in place")),
|
||||
|
|
|
@ -674,9 +674,9 @@ static int auto_number = 1;
|
|||
|
||||
static char *default_attach = NULL;
|
||||
|
||||
static struct string_list extra_hdr;
|
||||
static struct string_list extra_to;
|
||||
static struct string_list extra_cc;
|
||||
static struct string_list extra_hdr = STRING_LIST_INIT_NODUP;
|
||||
static struct string_list extra_to = STRING_LIST_INIT_NODUP;
|
||||
static struct string_list extra_cc = STRING_LIST_INIT_NODUP;
|
||||
|
||||
static void add_header(const char *value)
|
||||
{
|
||||
|
|
|
@ -247,7 +247,7 @@ struct branch_info {
|
|||
enum { NO_REBASE, NORMAL_REBASE, INTERACTIVE_REBASE } rebase;
|
||||
};
|
||||
|
||||
static struct string_list branch_list;
|
||||
static struct string_list branch_list = STRING_LIST_INIT_NODUP;
|
||||
|
||||
static const char *abbrev_ref(const char *name, const char *prefix)
|
||||
{
|
||||
|
|
|
@ -233,11 +233,11 @@ void shortlog_init(struct shortlog *log)
|
|||
|
||||
int cmd_shortlog(int argc, const char **argv, const char *prefix)
|
||||
{
|
||||
static struct shortlog log;
|
||||
static struct rev_info rev;
|
||||
struct shortlog log = { STRING_LIST_INIT_NODUP };
|
||||
struct rev_info rev;
|
||||
int nongit = !startup_info->have_repository;
|
||||
|
||||
static const struct option options[] = {
|
||||
const struct option options[] = {
|
||||
OPT_BOOL('n', "numbered", &log.sort_by_number,
|
||||
N_("sort output according to the number of commits per author")),
|
||||
OPT_BOOL('s', "summary", &log.summary,
|
||||
|
|
2
notes.c
2
notes.c
|
@ -70,7 +70,7 @@ struct non_note {
|
|||
|
||||
struct notes_tree default_notes_tree;
|
||||
|
||||
static struct string_list display_notes_refs;
|
||||
static struct string_list display_notes_refs = STRING_LIST_INIT_NODUP;
|
||||
static struct notes_tree **display_notes_trees;
|
||||
|
||||
static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
|
||||
|
|
|
@ -144,7 +144,7 @@ int parse_opt_string_list(const struct option *opt, const char *arg, int unset)
|
|||
if (!arg)
|
||||
return -1;
|
||||
|
||||
string_list_append(v, xstrdup(arg));
|
||||
string_list_append(v, arg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
static int config_fetch_recurse_submodules = RECURSE_SUBMODULES_ON_DEMAND;
|
||||
static int parallel_jobs = 1;
|
||||
static struct string_list changed_submodule_paths;
|
||||
static struct string_list changed_submodule_paths = STRING_LIST_INIT_NODUP;
|
||||
static int initialized_fetch_ref_tips;
|
||||
static struct sha1_array ref_tips_before_fetch;
|
||||
static struct sha1_array ref_tips_after_fetch;
|
||||
|
|
|
@ -12,7 +12,7 @@ static int dry_run = 0, quiet = 0;
|
|||
static char *string = NULL;
|
||||
static char *file = NULL;
|
||||
static int ambiguous;
|
||||
static struct string_list list;
|
||||
static struct string_list list = STRING_LIST_INIT_NODUP;
|
||||
|
||||
static struct {
|
||||
int called;
|
||||
|
|
Loading…
Reference in a new issue