From: Thiago Farina <tfransosi@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] string-list.h: Add STRING_LIST_INIT macro and make use of it.
Date: Sat, 26 Jun 2010 19:34:38 -0300 [thread overview]
Message-ID: <ef57c1f7439b43564af4ec88ddf100a9a908b745.1277591559.git.tfransosi@gmail.com> (raw)
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
---
builtin/fast-export.c | 2 +-
builtin/fetch.c | 8 ++++----
builtin/receive-pack.c | 2 +-
builtin/remote.c | 4 ++--
builtin/show-ref.c | 2 +-
remote.c | 4 ++--
string-list.h | 2 ++
7 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index c6dd71a..89945bc 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -566,7 +566,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
{
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;
struct commit *commit;
char *export_filename = NULL, *import_filename = NULL;
struct option options[] = {
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 5cb369c..a16fb43 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -572,8 +572,8 @@ static void find_non_local_tags(struct transport *transport,
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;
+ struct string_list remote_refs = STRING_LIST_INIT;
struct tag_data data;
const struct ref *ref;
struct string_list_item *item = NULL;
@@ -667,7 +667,7 @@ static int truncate_fetch_head(void)
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;
struct string_list_item *peer_item = NULL;
struct ref *ref_map;
struct ref *rm;
@@ -890,7 +890,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
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;
struct remote *remote;
int result = 0;
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 29bc8d5..c40a4ba 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -530,7 +530,7 @@ static void check_aliased_update(struct command *cmd, struct string_list *list)
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;
for (cmd = commands; cmd; cmd = cmd->next) {
struct string_list_item *item =
diff --git a/builtin/remote.c b/builtin/remote.c
index 0a52667..9d41792 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -596,7 +596,7 @@ static int mv(int argc, const char **argv)
};
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;
struct rename_info rename;
int i;
@@ -1044,7 +1044,7 @@ static int show(int argc, const char **argv)
OPT_END()
};
struct ref_states states;
- struct string_list info_list = { NULL, 0, 0, 0 };
+ struct string_list info_list = STRING_LIST_INIT;
struct show_info info;
argc = parse_options(argc, argv, NULL, options, builtin_remote_show_usage,
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 17ada88..25c280a 100644
--- 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;
char buf[1024];
int matchlen = match ? strlen(match) : 0;
diff --git a/remote.c b/remote.c
index e51cd22..059d757 100644
--- a/remote.c
+++ b/remote.c
@@ -754,7 +754,7 @@ int for_each_remote(each_remote_fn fn, void *priv)
void ref_remove_duplicates(struct ref *ref_map)
{
- struct string_list refs = { NULL, 0, 0, 0 };
+ struct string_list refs = STRING_LIST_INIT;
struct string_list_item *item = NULL;
struct ref *prev = NULL, *next = NULL;
for (; ref_map; prev = ref_map, ref_map = next) {
@@ -1704,7 +1704,7 @@ static int get_stale_heads_cb(const char *refname,
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;
struct stale_heads_info info;
info.remote = remote;
info.ref_names = &ref_names;
diff --git a/string-list.h b/string-list.h
index 63b69c8..037d058 100644
--- a/string-list.h
+++ b/string-list.h
@@ -12,6 +12,8 @@ struct string_list
unsigned int strdup_strings:1;
};
+#define STRING_LIST_INIT { NULL, 0, 0, 0 }
+
void print_string_list(const char *text, const struct string_list *p);
void string_list_clear(struct string_list *list, int free_util);
--
1.7.0.4
next reply other threads:[~2010-06-26 22:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-26 22:34 Thiago Farina [this message]
2010-06-26 22:53 ` [PATCH] string-list.h: Add STRING_LIST_INIT macro and make use of it Sverre Rabbelier
2010-06-26 23:04 ` Jonathan Nieder
2010-06-26 23:44 ` Thiago Farina
2010-06-26 23:40 ` Thiago Farina
2010-06-26 23:47 ` Thiago Farina
2010-06-27 16:44 ` Junio C Hamano
2010-06-28 8:29 ` Alex Riesen
2010-06-29 5:43 ` Junio C Hamano
2010-06-29 8:15 ` Peter Kjellerstedt
2010-06-29 8:33 ` Alex Riesen
2010-07-02 19:15 ` [PATCH] string_list: " Thiago Farina
2010-07-02 19:30 ` Jonathan Nieder
2010-07-02 19:47 ` Thiago Farina
2010-07-02 20:22 ` Jonathan Nieder
2010-07-04 19:46 ` Thiago Farina
2010-07-07 15:19 ` Jonathan Nieder
2010-07-07 16:55 ` Junio C Hamano
2010-07-10 5:01 ` Thiago Farina
2010-07-10 22:41 ` Jonathan Nieder
2010-08-19 13:28 ` Thiago Farina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ef57c1f7439b43564af4ec88ddf100a9a908b745.1277591559.git.tfransosi@gmail.com \
--to=tfransosi@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).