summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ebef827)
raw | patch | inline | side by side (parent: ebef827)
author | Gary V. Vaughan <git@mlists.thewrittenword.com> | |
Fri, 14 May 2010 09:31:33 +0000 (09:31 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 31 May 2010 23:59:26 +0000 (16:59 -0700) |
Unfortunately, there are still plenty of production systems with
vendor compilers that choke unless all compound declarations can be
determined statically at compile time, for example hpux10.20 (I can
provide a comprehensive list of our supported platforms that exhibit
this problem if necessary).
This patch simply breaks apart any compound declarations with dynamic
initialisation expressions, and moves the initialisation until after
the last declaration in the same block, in all the places necessary to
have the offending compilers accept the code.
Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
vendor compilers that choke unless all compound declarations can be
determined statically at compile time, for example hpux10.20 (I can
provide a comprehensive list of our supported platforms that exhibit
this problem if necessary).
This patch simply breaks apart any compound declarations with dynamic
initialisation expressions, and moves the initialisation until after
the last declaration in the same block, in all the places necessary to
have the offending compilers accept the code.
Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 files changed:
builtin/add.c | patch | blob | history | |
builtin/blame.c | patch | blob | history | |
builtin/cat-file.c | patch | blob | history | |
builtin/checkout.c | patch | blob | history | |
builtin/commit.c | patch | blob | history | |
builtin/fetch.c | patch | blob | history | |
builtin/remote.c | patch | blob | history | |
convert.c | patch | blob | history | |
daemon.c | patch | blob | history | |
ll-merge.c | patch | blob | history | |
refs.c | patch | blob | history | |
remote.c | patch | blob | history | |
unpack-trees.c | patch | blob | history | |
wt-status.c | patch | blob | history |
diff --git a/builtin/add.c b/builtin/add.c
index 87d2980313e71afc08df3eacde4a99a8468ff874..17149cfeedcc39956dc55f8b72acc1227fed5213 100644 (file)
--- a/builtin/add.c
+++ b/builtin/add.c
{
char *file = xstrdup(git_path("ADD_EDIT.patch"));
const char *apply_argv[] = { "apply", "--recount", "--cached",
- file, NULL };
+ NULL, NULL };
struct child_process child;
struct rev_info rev;
int out;
struct stat st;
+ apply_argv[3] = file;
+
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
if (read_cache() < 0)
diff --git a/builtin/blame.c b/builtin/blame.c
index fc1586350f94ae48e7e48a51818517b465e7a40d..1a42e2b77e9977ba927db839da0f44cfbd89450a 100644 (file)
--- a/builtin/blame.c
+++ b/builtin/blame.c
{
int last_in_target;
mmfile_t file_p, file_o;
- struct blame_chunk_cb_data d = { sb, target, parent, 0, 0 };
+ struct blame_chunk_cb_data d;
xpparam_t xpp;
xdemitconf_t xecfg;
-
+ memset(&d, 0, sizeof(d));
+ d.sb = sb; d.target = target; d.parent = parent;
last_in_target = find_last_in_target(sb, target);
if (last_in_target < 0)
return 1; /* nothing remains for this target */
const char *cp;
int cnt;
mmfile_t file_o;
- struct handle_split_cb_data d = { sb, ent, parent, split, 0, 0 };
+ struct handle_split_cb_data d;
xpparam_t xpp;
xdemitconf_t xecfg;
-
+ memset(&d, 0, sizeof(d));
+ d.sb = sb; d.ent = ent; d.parent = parent; d.split = split;
/*
* Prepare mmfile that contains only the lines in ent.
*/
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index a933eaa043257c84f35e1d86728ca91be035caff..e5118c57da2b69963894ff2994ac361ab7f6b837 100644 (file)
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
/* custom pretty-print here */
if (type == OBJ_TREE) {
- const char *ls_args[3] = {"ls-tree", obj_name, NULL};
+ const char *ls_args[3] = { NULL };
+ ls_args[0] = "ls-tree";
+ ls_args[1] = obj_name;
return cmd_ls_tree(2, ls_args, NULL);
}
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 88b1f43e05e64f0e8dcd6dd0461bbebd6fab1e25..9820351a30001d6d98d9aaea0ef01b56576bebe0 100644 (file)
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
static const char *unique_tracking_name(const char *name)
{
- struct tracking_name_data cb_data = { name, NULL, 1 };
+ struct tracking_name_data cb_data = { NULL, NULL, 1 };
+ cb_data.name = name;
for_each_ref(check_tracking_name, &cb_data);
if (cb_data.unique)
return cb_data.remote;
diff --git a/builtin/commit.c b/builtin/commit.c
index c5ab683d5b66d5ad85f53d13d6df71e29cd9234d..eb06945ae3a0d681b21f33ace882cdcb5569514b 100644 (file)
--- a/builtin/commit.c
+++ b/builtin/commit.c
if (use_editor) {
char index[PATH_MAX];
- const char *env[2] = { index, NULL };
+ const char *env[2] = { NULL };
+ env[0] = index;
snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
if (launch_editor(git_path(commit_editmsg), NULL, env)) {
fprintf(stderr,
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 8470850415c14cad8ceeca9f6baef46ab6feabc3..5cb369cfd1fbca1ceeee06b751c2b047f8a0e5b5 100644 (file)
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
{
struct string_list existing_refs = { NULL, 0, 0, 0 };
struct string_list remote_refs = { NULL, 0, 0, 0 };
- struct tag_data data = {head, tail};
+ struct tag_data data;
const struct ref *ref;
struct string_list_item *item = NULL;
+ data.head = head; data.tail = tail;
for_each_ref(add_existing, &existing_refs);
for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) {
static int add_remote_or_group(const char *name, struct string_list *list)
{
int prev_nr = list->nr;
- struct remote_group_data g = { name, list };
+ struct remote_group_data g;
+ g.name = name; g.list = list;
git_config(get_remote_group, &g);
if (list->nr == prev_nr) {
diff --git a/builtin/remote.c b/builtin/remote.c
index 277765b864202b2b6f20069e0cb3f95eaef4fcaa..23ece02aad31a7d1a5405ea3d5b8caefb265165b 100644 (file)
--- a/builtin/remote.c
+++ b/builtin/remote.c
struct known_remotes known_remotes = { NULL, NULL };
struct string_list branches = { NULL, 0, 0, 1 };
struct string_list skipped = { NULL, 0, 0, 1 };
- struct branches_for_remote cb_data = {
- NULL, &branches, &skipped, &known_remotes
- };
+ struct branches_for_remote cb_data;
int i, result;
+ memset(&cb_data, 0, sizeof(cb_data));
+ cb_data.branches = &branches;
+ cb_data.skipped = &skipped;
+ cb_data.keep = &known_remotes;
+
if (argc != 2)
usage_with_options(builtin_remote_rm_usage, options);
diff --git a/convert.c b/convert.c
index 4f8fcb7bbb00b66f1eaa354119784e6ef57e1eb4..3fea3e95091b5c49a7b38db381524f50436d11cf 100644 (file)
--- a/convert.c
+++ b/convert.c
struct child_process child_process;
struct filter_params *params = (struct filter_params *)data;
int write_err, status;
- const char *argv[] = { params->cmd, NULL };
+ const char *argv[] = { NULL, NULL };
+
+ argv[0] = params->cmd;
memset(&child_process, 0, sizeof(child_process));
child_process.argv = argv;
diff --git a/daemon.c b/daemon.c
index a90ab10505a3694de83a0ffd8fc472518f12cf2b..e22a2b7fa5f6fcfc5b26541a21c10d3c8b7eda81 100644 (file)
--- a/daemon.c
+++ b/daemon.c
}
else if (interpolated_path && saw_extended_args) {
struct strbuf expanded_path = STRBUF_INIT;
- struct strbuf_expand_dict_entry dict[] = {
- { "H", hostname },
- { "CH", canon_hostname },
- { "IP", ip_address },
- { "P", tcp_port },
- { "D", directory },
- { NULL }
- };
-
+ struct strbuf_expand_dict_entry dict[6];
+
+ dict[0].placeholder = "H"; dict[0].value = hostname;
+ dict[1].placeholder = "CH"; dict[1].value = canon_hostname;
+ dict[2].placeholder = "IP"; dict[2].value = ip_address;
+ dict[3].placeholder = "P"; dict[3].value = tcp_port;
+ dict[4].placeholder = "D"; dict[4].value = directory;
+ dict[5].placeholder = NULL; dict[5].value = NULL;
if (*dir != '/') {
/* Allow only absolute */
logerror("'%s': Non-absolute path denied (interpolated-path active)", dir);
{
/* Timeout as string */
char timeout_buf[64];
- const char *argv[] = { "upload-pack", "--strict", timeout_buf, ".", NULL };
+ const char *argv[] = { "upload-pack", "--strict", NULL, ".", NULL };
+
+ argv[2] = timeout_buf;
snprintf(timeout_buf, sizeof timeout_buf, "--timeout=%u", timeout);
return run_service_command(argv);
diff --git a/ll-merge.c b/ll-merge.c
index f9b3d854a921ab6fa3eed6f4dbf01af1a8657602..3764a1ab72354a3ce643c899c1e8cf5443d4e7cb 100644 (file)
--- a/ll-merge.c
+++ b/ll-merge.c
{
char temp[4][50];
struct strbuf cmd = STRBUF_INIT;
- struct strbuf_expand_dict_entry dict[] = {
- { "O", temp[0] },
- { "A", temp[1] },
- { "B", temp[2] },
- { "L", temp[3] },
- { NULL }
- };
+ struct strbuf_expand_dict_entry dict[5];
const char *args[] = { NULL, NULL };
int status, fd, i;
struct stat st;
+ dict[0].placeholder = "O"; dict[0].value = temp[0];
+ dict[1].placeholder = "A"; dict[1].value = temp[1];
+ dict[2].placeholder = "B"; dict[2].value = temp[2];
+ dict[3].placeholder = "L"; dict[3].value = temp[3];
+ dict[4].placeholder = NULL; dict[4].value = NULL;
+
if (fn->cmdline == NULL)
die("custom merge driver %s lacks command line.", fn->name);
index d3db15a76cc46f6f6a31d4448816c09e6c48e543..a7ad3fd8fa4f9f57776ba933f6976af661cb17e7 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -314,7 +314,11 @@ static int warn_if_dangling_symref(const char *refname, const unsigned char *sha
void warn_dangling_symref(FILE *fp, const char *msg_fmt, const char *refname)
{
- struct warn_if_dangling_data data = { fp, refname, msg_fmt };
+ struct warn_if_dangling_data data;
+
+ data.fp = fp;
+ data.refname = refname;
+ data.msg_fmt = msg_fmt;
for_each_rawref(warn_if_dangling_symref, &data);
}
diff --git a/remote.c b/remote.c
index c70181cdc621b27ed02aba17b3e4f7ab64518e9f..ade04246e06ebe52074888790486e88108bc1d76 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -657,10 +657,9 @@ static struct refspec *parse_refspec_internal(int nr_refspec, const char **refsp
int valid_fetch_refspec(const char *fetch_refspec_str)
{
- const char *fetch_refspec[] = { fetch_refspec_str };
struct refspec *refspec;
- refspec = parse_refspec_internal(1, fetch_refspec, 1, 1);
+ refspec = parse_refspec_internal(1, &fetch_refspec_str, 1, 1);
free_refspecs(refspec, 1);
return !!refspec;
}
diff --git a/unpack-trees.c b/unpack-trees.c
index 75f54cac97f62ddaad736c2cd582cc6cdeaaebfa..69782b1cc2139268fc87effc8e4ce99d3d8ee6d5 100644 (file)
--- a/unpack-trees.c
+++ b/unpack-trees.c
static int unpack_index_entry(struct cache_entry *ce,
struct unpack_trees_options *o)
{
- struct cache_entry *src[5] = { ce, NULL, };
+ struct cache_entry *src[5] = { NULL };
int ret;
+ src[0] = ce;
+
mark_ce_used(ce, o);
if (ce_stage(ce)) {
if (o->skip_unmerged) {
diff --git a/wt-status.c b/wt-status.c
index 8ca59a2d2abec0c9c4629cd4ae7340fcd79a0c7e..24bbd8b9156e89add78dc1dfd451c36b11edfc4c 100644 (file)
--- a/wt-status.c
+++ b/wt-status.c
@@ -498,17 +498,18 @@ static void wt_status_print_submodule_summary(struct wt_status *s, int uncommitt
struct child_process sm_summary;
char summary_limit[64];
char index[PATH_MAX];
- const char *env[] = { index, NULL };
- const char *argv[] = {
- "submodule",
- "summary",
- uncommitted ? "--files" : "--cached",
- "--for-status",
- "--summary-limit",
- summary_limit,
- uncommitted ? NULL : (s->amend ? "HEAD^" : "HEAD"),
- NULL
- };
+ const char *env[] = { NULL, NULL };
+ const char *argv[8];
+
+ env[0] = index;
+ argv[0] = "submodule";
+ argv[1] = "summary";
+ argv[2] = uncommitted ? "--files" : "--cached";
+ argv[3] = "--for-status";
+ argv[4] = "--summary-limit";
+ argv[5] = summary_limit;
+ argv[6] = uncommitted ? NULL : (s->amend ? "HEAD^" : "HEAD");
+ argv[7] = NULL;
sprintf(summary_limit, "%d", s->submodule_summary);
snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", s->index_file);