{"thread":{"id":"20806","subject":"[PATCH] Style fixes, add a space after if/for/while.","startedAt":"2009-09-01T05:35:10Z","lastAt":"2009-09-01T05:35:10Z","messageCount":1,"participants":["Brian Gianforcaro"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"122225","messageId":"4A9CB28E.4040701@gmail.com","threadId":"20806","inReplyTo":null,"subject":"[PATCH] Style fixes, add a space after if/for/while.","fromName":"Brian Gianforcaro","fromEmail":"b.gianfo@gmail.com","sentAt":"2009-09-01T05:35:10Z","receivedAt":"2009-09-01T05:35:10Z","isPatch":true,"sender":{"key":"b.gianfo@gmail.com","avatar":null},"body":"The majority of code in core git appears to use a single\nspace after if/for/while. This is an attempt to bring more\ncode to this standard. These are entirely cosmetic changes.\n\n Signed-off-by: Brian Gianforcaro <b.gianfo@gmail.com>\n\n---\n builtin-blame.c        |    2 +-\n builtin-clone.c        |    2 +-\n builtin-for-each-ref.c |    2 +-\n builtin-pack-objects.c |    2 +-\n builtin-remote.c       |    4 ++--\n builtin-shortlog.c     |    2 +-\n connect.c              |    2 +-\n diff.c                 |    2 +-\n pack-redundant.c       |   28 ++++++++++++++--------------\n remote.c               |    2 +-\n upload-pack.c          |    2 +-\n var.c                  |    4 ++--\n wt-status.c            |    2 +-\n 13 files changed, 28 insertions(+), 28 deletions(-)\n\ndiff --git a/builtin-blame.c b/builtin-blame.c\nindex fd6ca51..7512773 100644\n--- a/builtin-blame.c\n+++ b/builtin-blame.c\n@@ -1348,7 +1348,7 @@ static void get_ac_line(const char *inbuf, const char *what,\n \t/*\n \t * Now, convert both name and e-mail using mailmap\n \t */\n-\tif(map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {\n+\tif (map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {\n \t\t/* Add a trailing '>' to email, since map_user returns plain emails\n \t\t   Note: It already has '<', since we replace from mail+1 */\n \t\tmailpos = memchr(mail, '\\0', mail_len);\ndiff --git a/builtin-clone.c b/builtin-clone.c\nindex 0d2b4a8..991a7ae 100644\n--- a/builtin-clone.c\n+++ b/builtin-clone.c\n@@ -515,7 +515,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \t\t\t\t\t     option_upload_pack);\n \n \t\trefs = transport_get_remote_refs(transport);\n-\t\tif(refs)\n+\t\tif (refs)\n \t\t\ttransport_fetch_refs(transport, refs);\n \t}\n \ndiff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c\nindex d7cc8ca..a5a83f1 100644\n--- a/builtin-for-each-ref.c\n+++ b/builtin-for-each-ref.c\n@@ -576,7 +576,7 @@ static void populate_value(struct refinfo *ref)\n \n \t\tif (!prefixcmp(name, \"refname\"))\n \t\t\trefname = ref->refname;\n-\t\telse if(!prefixcmp(name, \"upstream\")) {\n+\t\telse if (!prefixcmp(name, \"upstream\")) {\n \t\t\tstruct branch *branch;\n \t\t\t/* only local branches may have an upstream */\n \t\t\tif (prefixcmp(ref->refname, \"refs/heads/\"))\ndiff --git a/builtin-pack-objects.c b/builtin-pack-objects.c\nindex c433748..c918d4b 100644\n--- a/builtin-pack-objects.c\n+++ b/builtin-pack-objects.c\n@@ -1808,7 +1808,7 @@ static void prepare_pack(int window, int depth)\n \n static int git_pack_config(const char *k, const char *v, void *cb)\n {\n-\tif(!strcmp(k, \"pack.window\")) {\n+\tif (!strcmp(k, \"pack.window\")) {\n \t\twindow = git_config_int(k, v);\n \t\treturn 0;\n \t}\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex 008abfe..0777dd7 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -385,7 +385,7 @@ static int get_head_names(const struct ref *remote_refs, struct ref_states *stat\n \tget_fetch_map(remote_refs, &refspec, &fetch_map_tail, 0);\n \tmatches = guess_remote_head(find_ref_by_name(remote_refs, \"HEAD\"),\n \t\t\t\t    fetch_map, 1);\n-\tfor(ref = matches; ref; ref = ref->next)\n+\tfor (ref = matches; ref; ref = ref->next)\n \t\tstring_list_append(abbrev_branch(ref->name), &states->heads);\n \n \tfree_refs(fetch_map);\n@@ -484,7 +484,7 @@ static int read_remote_branches(const char *refname,\n \tconst char *symref;\n \n \tstrbuf_addf(&buf, \"refs/remotes/%s\", rename->old);\n-\tif(!prefixcmp(refname, buf.buf)) {\n+\tif (!prefixcmp(refname, buf.buf)) {\n \t\titem = string_list_append(xstrdup(refname), rename->remote_branches);\n \t\tsymref = resolve_ref(refname, orig_sha1, 1, &flag);\n \t\tif (flag & REF_ISSYMREF)\ndiff --git a/builtin-shortlog.c b/builtin-shortlog.c\nindex 6a3812e..4d4a3c8 100644\n--- a/builtin-shortlog.c\n+++ b/builtin-shortlog.c\n@@ -56,7 +56,7 @@ static void insert_one_record(struct shortlog *log,\n \t/* copy author name to namebuf, to support matching on both name and email */\n \tmemcpy(namebuf, author, boemail - author);\n \tlen = boemail - author;\n-\twhile(len > 0 && isspace(namebuf[len-1]))\n+\twhile (len > 0 && isspace(namebuf[len-1]))\n \t\tlen--;\n \tnamebuf[len] = 0;\n \ndiff --git a/connect.c b/connect.c\nindex 76e5427..7945e38 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -513,7 +513,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,\n \tsignal(SIGCHLD, SIG_DFL);\n \n \thost = strstr(url, \"://\");\n-\tif(host) {\n+\tif (host) {\n \t\t*host = '\\0';\n \t\tprotocol = get_protocol(url);\n \t\thost += 3;\ndiff --git a/diff.c b/diff.c\nindex cd35e0c..e1be189 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2691,7 +2691,7 @@ static int parse_num(const char **cp_p)\n \tnum = 0;\n \tscale = 1;\n \tdot = 0;\n-\tfor(;;) {\n+\tfor (;;) {\n \t\tch = *cp;\n \t\tif ( !dot && ch == '.' ) {\n \t\t\tscale = 1;\ndiff --git a/pack-redundant.c b/pack-redundant.c\nindex 48a12bc..a3fad74 100644\n--- a/pack-redundant.c\n+++ b/pack-redundant.c\n@@ -55,7 +55,7 @@ static inline struct llist_item *llist_item_get(void)\n \t} else {\n \t\tint i = 1;\n \t\tnew = xmalloc(sizeof(struct llist_item) * BLKSIZE);\n-\t\tfor(;i < BLKSIZE; i++) {\n+\t\tfor (;i < BLKSIZE; i++) {\n \t\t\tllist_item_put(&new[i]);\n \t\t}\n \t}\n@@ -64,7 +64,7 @@ static inline struct llist_item *llist_item_get(void)\n \n static void llist_free(struct llist *list)\n {\n-\twhile((list->back = list->front)) {\n+\twhile ((list->back = list->front)) {\n \t\tlist->front = list->front->next;\n \t\tllist_item_put(list->back);\n \t}\n@@ -146,7 +146,7 @@ static inline struct llist_item *llist_insert_sorted_unique(struct llist *list,\n \t\tif (cmp > 0) { /* we insert before this entry */\n \t\t\treturn llist_insert(list, prev, sha1);\n \t\t}\n-\t\tif(!cmp) { /* already exists */\n+\t\tif (!cmp) { /* already exists */\n \t\t\treturn l;\n \t\t}\n \t\tprev = l;\n@@ -168,7 +168,7 @@ redo_from_start:\n \t\tint cmp = hashcmp(l->sha1, sha1);\n \t\tif (cmp > 0) /* not in list, since sorted */\n \t\t\treturn prev;\n-\t\tif(!cmp) { /* found */\n+\t\tif (!cmp) { /* found */\n \t\t\tif (prev == NULL) {\n \t\t\t\tif (hint != NULL && hint != list->front) {\n \t\t\t\t\t/* we don't know the previous element */\n@@ -218,7 +218,7 @@ static inline struct pack_list * pack_list_insert(struct pack_list **pl,\n static inline size_t pack_list_size(struct pack_list *pl)\n {\n \tsize_t ret = 0;\n-\twhile(pl) {\n+\twhile (pl) {\n \t\tret++;\n \t\tpl = pl->next;\n \t}\n@@ -396,7 +396,7 @@ static size_t get_pack_redundancy(struct pack_list *pl)\n \t\treturn 0;\n \n \twhile ((subset = pl->next)) {\n-\t\twhile(subset) {\n+\t\twhile (subset) {\n \t\t\tret += sizeof_union(pl->pack, subset->pack);\n \t\t\tsubset = subset->next;\n \t\t}\n@@ -427,7 +427,7 @@ static void minimize(struct pack_list **min)\n \n \tpl = local_packs;\n \twhile (pl) {\n-\t\tif(pl->unique_objects->size)\n+\t\tif (pl->unique_objects->size)\n \t\t\tpack_list_insert(&unique, pl);\n \t\telse\n \t\t\tpack_list_insert(&non_unique, pl);\n@@ -479,7 +479,7 @@ static void minimize(struct pack_list **min)\n \t*min = min_perm;\n \t/* add the unique packs to the list */\n \tpl = unique;\n-\twhile(pl) {\n+\twhile (pl) {\n \t\tpack_list_insert(min, pl);\n \t\tpl = pl->next;\n \t}\n@@ -516,7 +516,7 @@ static void cmp_local_packs(void)\n \tstruct pack_list *subset, *pl = local_packs;\n \n \twhile ((subset = pl)) {\n-\t\twhile((subset = subset->next))\n+\t\twhile ((subset = subset->next))\n \t\t\tcmp_two_packs(pl, subset);\n \t\tpl = pl->next;\n \t}\n@@ -608,23 +608,23 @@ int main(int argc, char **argv)\n \n \tfor (i = 1; i < argc; i++) {\n \t\tconst char *arg = argv[i];\n-\t\tif(!strcmp(arg, \"--\")) {\n+\t\tif (!strcmp(arg, \"--\")) {\n \t\t\ti++;\n \t\t\tbreak;\n \t\t}\n-\t\tif(!strcmp(arg, \"--all\")) {\n+\t\tif (!strcmp(arg, \"--all\")) {\n \t\t\tload_all_packs = 1;\n \t\t\tcontinue;\n \t\t}\n-\t\tif(!strcmp(arg, \"--verbose\")) {\n+\t\tif (!strcmp(arg, \"--verbose\")) {\n \t\t\tverbose = 1;\n \t\t\tcontinue;\n \t\t}\n-\t\tif(!strcmp(arg, \"--alt-odb\")) {\n+\t\tif (!strcmp(arg, \"--alt-odb\")) {\n \t\t\talt_odb = 1;\n \t\t\tcontinue;\n \t\t}\n-\t\tif(*arg == '-')\n+\t\tif (*arg == '-')\n \t\t\tusage(pack_redundant_usage);\n \t\telse\n \t\t\tbreak;\ndiff --git a/remote.c b/remote.c\nindex c3ada2d..4b5b905 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1038,7 +1038,7 @@ static int match_explicit(struct ref *src, struct ref *dst,\n \tcase 0:\n \t\tif (!memcmp(dst_value, \"refs/\", 5))\n \t\t\tmatched_dst = make_linked_ref(dst_value, dst_tail);\n-\t\telse if((dst_guess = guess_ref(dst_value, matched_src)))\n+\t\telse if ((dst_guess = guess_ref(dst_value, matched_src)))\n \t\t\tmatched_dst = make_linked_ref(dst_guess, dst_tail);\n \t\telse\n \t\t\terror(\"unable to push to unqualified destination: %s\\n\"\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 4d8be83..dacbc76 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -427,7 +427,7 @@ static int get_common_commits(void)\n \n \tsave_commit_buffer = 0;\n \n-\tfor(;;) {\n+\tfor (;;) {\n \t\tint len = packet_read_line(0, line, sizeof(line));\n \t\treset_timeout();\n \ndiff --git a/var.c b/var.c\nindex 7362ed8..a807dea 100644\n--- a/var.c\n+++ b/var.c\n@@ -21,7 +21,7 @@ static struct git_var git_vars[] = {\n static void list_vars(void)\n {\n \tstruct git_var *ptr;\n-\tfor(ptr = git_vars; ptr->read; ptr++) {\n+\tfor (ptr = git_vars; ptr->read; ptr++) {\n \t\tprintf(\"%s=%s\\n\", ptr->name, ptr->read(IDENT_WARN_ON_NO_NAME));\n \t}\n }\n@@ -31,7 +31,7 @@ static const char *read_var(const char *var)\n \tstruct git_var *ptr;\n \tconst char *val;\n \tval = NULL;\n-\tfor(ptr = git_vars; ptr->read; ptr++) {\n+\tfor (ptr = git_vars; ptr->read; ptr++) {\n \t\tif (strcmp(var, ptr->name) == 0) {\n \t\t\tval = ptr->read(IDENT_ERROR_ON_NO_NAME);\n \t\t\tbreak;\ndiff --git a/wt-status.c b/wt-status.c\nindex 63598ce..3395456 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -326,7 +326,7 @@ static void wt_status_collect_untracked(struct wt_status *s)\n \tsetup_standard_excludes(&dir);\n \n \tfill_directory(&dir, NULL);\n-\tfor(i = 0; i < dir.nr; i++) {\n+\tfor (i = 0; i < dir.nr; i++) {\n \t\tstruct dir_entry *ent = dir.entries[i];\n \t\tif (!cache_name_is_other(ent->name, ent->len))\n \t\t\tcontinue;\n-- \n1.6.3.3\n"}]}