summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a57c6e)
raw | patch | inline | side by side (parent: 8a57c6e)
author | Thiago Farina <tfransosi@gmail.com> | |
Sun, 4 Jul 2010 19:46:19 +0000 (16:46 -0300) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 5 Jul 2010 18:47:57 +0000 (11:47 -0700) |
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 files changed:
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 9fe25ff0b3dc0ae89c668b146b46a4ccbd457361..834ec8b464d0ce5845a2312766554b60ed5d5d7e 100644 (file)
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
{
struct rev_info revs;
struct object_array commits = { 0, 0, NULL };
- struct string_list extra_refs = { NULL, 0, 0, 0 };
+ struct string_list extra_refs = STRING_LIST_INIT_NODUP;
struct commit *commit;
char *export_filename = NULL, *import_filename = NULL;
struct option options[] = {
diff --git a/builtin/fetch.c b/builtin/fetch.c
index b0bfaa9ae32021b6b32c9bdce99ccc543c9ecab7..88ff3575f81b234c1b916c2df4a27a01d84b9405 100644 (file)
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
struct ref **head,
struct ref ***tail)
{
- struct string_list existing_refs = { NULL, 0, 0, 0 };
- struct string_list remote_refs = { NULL, 0, 0, 0 };
+ struct string_list existing_refs = STRING_LIST_INIT_NODUP;
+ struct string_list remote_refs = STRING_LIST_INIT_NODUP;
const struct ref *ref;
struct string_list_item *item = NULL;
static int do_fetch(struct transport *transport,
struct refspec *refs, int ref_count)
{
- struct string_list existing_refs = { NULL, 0, 0, 0 };
+ struct string_list existing_refs = STRING_LIST_INIT_NODUP;
struct string_list_item *peer_item = NULL;
struct ref *ref_map;
struct ref *rm;
int cmd_fetch(int argc, const char **argv, const char *prefix)
{
int i;
- struct string_list list = { NULL, 0, 0, 0 };
+ struct string_list list = STRING_LIST_INIT_NODUP;
struct remote *remote;
int result = 0;
index bc3c5e6d3ec50eaa9829358ee0a82a1438c19f89..a76cd4e9d131eb76edb8a88f675dc14d4b3f597e 100644 (file)
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
data->generic.strdup_strings = 1;
}
-static struct string_list srcs = { NULL, 0, 0, 1 };
-static struct string_list origins = { NULL, 0, 0, 1 };
+static struct string_list srcs = STRING_LIST_INIT_DUP;
+static struct string_list origins = STRING_LIST_INIT_DUP;
static int handle_line(char *line)
{
int i, count = 0;
struct commit *commit;
struct object *branch;
- struct string_list subjects = { NULL, 0, 0, 1 };
+ struct string_list subjects = STRING_LIST_INIT_DUP;
int flags = UNINTERESTING | TREESAME | SEEN | SHOWN | ADDED;
struct strbuf sb = STRBUF_INIT;
diff --git a/builtin/grep.c b/builtin/grep.c
index 232cd1ce07bf3f695c722e6217ce653ff704d64b..103f64a210b854b531b2b333fc567a7965c3e87d 100644 (file)
--- a/builtin/grep.c
+++ b/builtin/grep.c
struct grep_opt opt;
struct object_array list = { 0, 0, NULL };
const char **paths = NULL;
- struct string_list path_list = { NULL, 0, 0, 0 };
+ struct string_list path_list = STRING_LIST_INIT_NODUP;
int i;
int dummy;
int nongit = 0, use_index = 1;
diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c
index e4560da19138cd67843f93a05bc6509d51cfe076..99654d02221c13ff98f268ad2dee99f16e794750 100644 (file)
--- a/builtin/mailsplit.c
+++ b/builtin/mailsplit.c
char name[PATH_MAX];
int ret = -1;
int i;
- struct string_list list = {NULL, 0, 0, 1};
+ struct string_list list = STRING_LIST_INIT_DUP;
if (populate_maildir_list(&list, maildir) < 0)
goto out;
diff --git a/builtin/mv.c b/builtin/mv.c
index 38574b89f7cfc127b2ea5044b3ebb5dabe726fb4..cdbb09473c0c45efff23a63e78b7623cad523350 100644 (file)
--- a/builtin/mv.c
+++ b/builtin/mv.c
const char **source, **destination, **dest_path;
enum update_mode { BOTH = 0, WORKING_DIRECTORY, INDEX } *modes;
struct stat st;
- struct string_list src_for_dst = {NULL, 0, 0, 0};
+ struct string_list src_for_dst = STRING_LIST_INIT_NODUP;
git_config(git_default_config, NULL);
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index d634b5a3d5212b8e49217d94430c294b911dfc7d..760817dbd7fec0086a0a1b62e58ab4438f227b7b 100644 (file)
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
static void check_aliased_updates(struct command *commands)
{
struct command *cmd;
- struct string_list ref_list = { NULL, 0, 0, 0 };
+ struct string_list ref_list = STRING_LIST_INIT_NODUP;
for (cmd = commands; cmd; cmd = cmd->next) {
struct string_list_item *item =
diff --git a/builtin/remote.c b/builtin/remote.c
index 6699bc571235167f5cae60106522c09a10ae341d..48e0a6bf260cab18d44058ade554e3a9d5946b93 100644 (file)
--- a/builtin/remote.c
+++ b/builtin/remote.c
static int add(int argc, const char **argv)
{
int fetch = 0, mirror = 0, fetch_tags = TAGS_DEFAULT;
- struct string_list track = { NULL, 0, 0 };
+ struct string_list track = STRING_LIST_INIT_NODUP;
const char *master = NULL;
struct remote *remote;
struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT;
};
struct remote *oldremote, *newremote;
struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT, buf3 = STRBUF_INIT;
- struct string_list remote_branches = { NULL, 0, 0, 0 };
+ struct string_list remote_branches = STRING_LIST_INIT_NODUP;
struct rename_info rename;
int i;
struct remote *remote;
struct strbuf buf = STRBUF_INIT;
struct known_remotes known_remotes = { NULL, NULL };
- struct string_list branches = { NULL, 0, 0, 1 };
- struct string_list skipped = { NULL, 0, 0, 1 };
+ struct string_list branches = STRING_LIST_INIT_DUP;
+ struct string_list skipped = STRING_LIST_INIT_DUP;
struct branches_for_remote cb_data;
int i, result;
OPT_END()
};
struct ref_states states;
- struct string_list info_list = { NULL, 0, 0, 0 };
+ struct string_list info_list = STRING_LIST_INIT_NODUP;
struct show_info info;
argc = parse_options(argc, argv, NULL, options, builtin_remote_show_usage,
static int show_all(void)
{
- struct string_list list = { NULL, 0, 0 };
+ struct string_list list = STRING_LIST_INIT_NODUP;
int result;
list.strdup_strings = 1;
diff --git a/builtin/rerere.c b/builtin/rerere.c
index 980d5421eee881ccb84c20dfb7aaae7dbb6a06ab..3c8e45843e148758fece8b64015754b7d56ec6d1 100644 (file)
--- a/builtin/rerere.c
+++ b/builtin/rerere.c
static void garbage_collect(struct string_list *rr)
{
- struct string_list to_remove = { NULL, 0, 0, 1 };
+ struct string_list to_remove = STRING_LIST_INIT_DUP;
DIR *dir;
struct dirent *e;
int i, cutoff;
int cmd_rerere(int argc, const char **argv, const char *prefix)
{
- struct string_list merge_rr = { NULL, 0, 0, 1 };
+ struct string_list merge_rr = STRING_LIST_INIT_DUP;
int i, fd, flags = 0;
if (2 < argc) {
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 0b2a9ad1a9a8a825c2e2104f8a9f729a9cb03d1a..be9b512eebc72984e6ff4cdd4859ab7951539e19 100644 (file)
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -120,7 +120,7 @@ static int add_existing(const char *refname, const unsigned char *sha1, int flag
*/
static int exclude_existing(const char *match)
{
- static struct string_list existing_refs = { NULL, 0, 0, 0 };
+ static struct string_list existing_refs = STRING_LIST_INIT_NODUP;
char buf[1024];
int matchlen = match ? strlen(match) : 0;
diff --git a/diff-no-index.c b/diff-no-index.c
index 43aeeba2e0fd9c3c175dbc74a6f488e2c352c928..ce9e783407437bb1e0efc6d5bc2392af26da5a41 100644 (file)
--- a/diff-no-index.c
+++ b/diff-no-index.c
if (S_ISDIR(mode1) || S_ISDIR(mode2)) {
char buffer1[PATH_MAX], buffer2[PATH_MAX];
- struct string_list p1 = {NULL, 0, 0, 1}, p2 = {NULL, 0, 0, 1};
+ struct string_list p1 = STRING_LIST_INIT_DUP;
+ struct string_list p2 = STRING_LIST_INIT_DUP;
int len1 = 0, len2 = 0, i1, i2, ret = 0;
if (name1 && read_directory(name1, &p1))
diff --git a/merge-recursive.c b/merge-recursive.c
index 856e98c0837f422f18d57aa4f3ca453120882bca..1c065d306f4cea8076c29b56f277404a1c815eb0 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
struct string_list *b_renames)
{
int clean_merge = 1, i, j;
- struct string_list a_by_dst = {NULL, 0, 0, 0}, b_by_dst = {NULL, 0, 0, 0};
+ struct string_list a_by_dst = STRING_LIST_INIT_NODUP;
+ struct string_list b_by_dst = STRING_LIST_INIT_NODUP;
const struct rename *sre;
for (i = 0; i < a_renames->nr; i++) {
diff --git a/remote.c b/remote.c
index afbba47460c0204721d61800033ed0a9f93f92bc..9143ec7a1772c45b6c3d4c84f6fc000040400dee 100644 (file)
--- a/remote.c
+++ b/remote.c
void ref_remove_duplicates(struct ref *ref_map)
{
- struct string_list refs = { NULL, 0, 0, 0 };
+ struct string_list refs = STRING_LIST_INIT_NODUP;
struct string_list_item *item = NULL;
struct ref *prev = NULL, *next = NULL;
for (; ref_map; prev = ref_map, ref_map = next) {
struct ref *get_stale_heads(struct remote *remote, struct ref *fetch_map)
{
struct ref *ref, *stale_refs = NULL;
- struct string_list ref_names = { NULL, 0, 0, 0 };
+ struct string_list ref_names = STRING_LIST_INIT_NODUP;
struct stale_heads_info info;
info.remote = remote;
info.ref_names = &ref_names;
diff --git a/rerere.c b/rerere.c
index d03a69634b81e1146c20182670a400b0c29b275f..78bbcf140346f14bbb961ed5e39e5752568b8d95 100644 (file)
--- a/rerere.c
+++ b/rerere.c
static int do_plain_rerere(struct string_list *rr, int fd)
{
- struct string_list conflict = { NULL, 0, 0, 1 };
- struct string_list update = { NULL, 0, 0, 1 };
+ struct string_list conflict = STRING_LIST_INIT_DUP;
+ struct string_list update = STRING_LIST_INIT_DUP;
int i;
find_conflict(&conflict);
int rerere(int flags)
{
- struct string_list merge_rr = { NULL, 0, 0, 1 };
+ struct string_list merge_rr = STRING_LIST_INIT_DUP;
int fd;
fd = setup_rerere(&merge_rr, flags);
int rerere_forget(const char **pathspec)
{
int i, fd;
- struct string_list conflict = { NULL, 0, 0, 1 };
- struct string_list merge_rr = { NULL, 0, 0, 1 };
+ struct string_list conflict = STRING_LIST_INIT_DUP;
+ struct string_list merge_rr = STRING_LIST_INIT_DUP;
if (read_cache() < 0)
return error("Could not read index");
diff --git a/string-list.h b/string-list.h
index a37cae599ab61d3d09b08a9cc67e99841cfa6ed6..494693898b89fe2f8145b483ea7e366e9b1192c1 100644 (file)
--- a/string-list.h
+++ b/string-list.h
unsigned int strdup_strings:1;
};
+#define STRING_LIST_INIT_NODUP { NULL, 0, 0, 0 }
+#define STRING_LIST_INIT_DUP { NULL, 0, 0, 1 }
+
void print_string_list(const struct string_list *p, const char *text);
void string_list_clear(struct string_list *list, int free_util);
diff --git a/transport-helper.c b/transport-helper.c
index 191fbf798a5e5db1abeafc719e8ec0d986a1050c..acfc88e3f1f0e99863512bf2c6ea82f1283cc35d 100644 (file)
--- a/transport-helper.c
+++ b/transport-helper.c
struct child_process *helper, exporter;
struct helper_data *data = transport->data;
char *export_marks = NULL, *import_marks = NULL;
- struct string_list revlist_args = { NULL, 0, 0 };
+ struct string_list revlist_args = STRING_LIST_INIT_NODUP;
struct strbuf buf = STRBUF_INIT;
helper = get_helper(transport);