Style fixes, add a space after if/for/while.
The majority of code in core git appears to use a single space after if/for/while. This is an attempt to bring more code to this standard. These are entirely cosmetic changes. Signed-off-by: Brian Gianforcaro <b.gianfo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brian Gianforcaro committed
Sep 1, 2009 at 01:35 UTC
eeefa7c90e1b754a2b01d73fd93aaf90afdc4914
13 files changed
+28
-30
builtin-blame.c
+1
-1
@@ -1348,7 +1348,7 @@ static void get_ac_line(const char *inbuf, const char *what,
1348
/*
1349
* Now, convert both name and e-mail using mailmap
1350
*/
1351
- if(map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {
1351
+ if (map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {
1352
/* Add a trailing '>' to email, since map_user returns plain emails
1353
Note: It already has '<', since we replace from mail+1 */
1354
mailpos = memchr(mail, '\0', mail_len);
builtin-clone.c
+1
-1
@@ -515,7 +515,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
515
option_upload_pack);
516
517
refs = transport_get_remote_refs(transport);
518
- if(refs)
518
+ if (refs)
519
transport_fetch_refs(transport, refs);
520
}
521
builtin-for-each-ref.c
+1
-1
@@ -576,7 +576,7 @@ static void populate_value(struct refinfo *ref)
576
577
if (!prefixcmp(name, "refname"))
578
refname = ref->refname;
579
- else if(!prefixcmp(name, "upstream")) {
579
+ else if (!prefixcmp(name, "upstream")) {
580
struct branch *branch;
581
/* only local branches may have an upstream */
582
if (prefixcmp(ref->refname, "refs/heads/"))
builtin-pack-objects.c
+1
-1
@@ -1808,7 +1808,7 @@ static void prepare_pack(int window, int depth)
1808
1809
static int git_pack_config(const char *k, const char *v, void *cb)
1810
{
1811
- if(!strcmp(k, "pack.window")) {
1811
+ if (!strcmp(k, "pack.window")) {
1812
window = git_config_int(k, v);
1813
return 0;
1814
}
builtin-remote.c
+2
-2
@@ -385,7 +385,7 @@ static int get_head_names(const struct ref *remote_refs, struct ref_states *stat
385
get_fetch_map(remote_refs, &refspec, &fetch_map_tail, 0);
386
matches = guess_remote_head(find_ref_by_name(remote_refs, "HEAD"),
387
fetch_map, 1);
388
- for(ref = matches; ref; ref = ref->next)
388
+ for (ref = matches; ref; ref = ref->next)
389
string_list_append(abbrev_branch(ref->name), &states->heads);
390
391
free_refs(fetch_map);
@@ -484,7 +484,7 @@ static int read_remote_branches(const char *refname,
484
const char *symref;
485
486
strbuf_addf(&buf, "refs/remotes/%s", rename->old);
487
- if(!prefixcmp(refname, buf.buf)) {
487
+ if (!prefixcmp(refname, buf.buf)) {
488
item = string_list_append(xstrdup(refname), rename->remote_branches);
489
symref = resolve_ref(refname, orig_sha1, 1, &flag);
490
if (flag & REF_ISSYMREF)
builtin-shortlog.c
+1
-1
@@ -56,7 +56,7 @@ static void insert_one_record(struct shortlog *log,
56
/* copy author name to namebuf, to support matching on both name and email */
57
memcpy(namebuf, author, boemail - author);
58
len = boemail - author;
59
- while(len > 0 && isspace(namebuf[len-1]))
59
+ while (len > 0 && isspace(namebuf[len-1]))
60
len--;
61
namebuf[len] = 0;
62
connect.c
+1
-1
@@ -513,7 +513,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
513
signal(SIGCHLD, SIG_DFL);
514
515
host = strstr(url, "://");
516
- if(host) {
516
+ if (host) {
517
*host = '\0';
518
protocol = get_protocol(url);
519
host += 3;
diff.c
+1
-1
@@ -2691,7 +2691,7 @@ static int parse_num(const char **cp_p)
2691
num = 0;
2692
scale = 1;
2693
dot = 0;
2694
- for(;;) {
2694
+ for (;;) {
2695
ch = *cp;
2696
if ( !dot && ch == '.' ) {
2697
scale = 1;
pack-redundant.c
+14
-15
@@ -55,16 +55,15 @@ static inline struct llist_item *llist_item_get(void)
55
} else {
56
int i = 1;
57
new = xmalloc(sizeof(struct llist_item) * BLKSIZE);
58
- for(;i < BLKSIZE; i++) {
58
+ for (; i < BLKSIZE; i++)
59
llist_item_put(&new[i]);
60
- }
60
}
61
return new;
62
}
63
64
static void llist_free(struct llist *list)
65
{
67
- while((list->back = list->front)) {
66
+ while ((list->back = list->front)) {
67
list->front = list->front->next;
68
llist_item_put(list->back);
69
}
@@ -146,7 +145,7 @@ static inline struct llist_item *llist_insert_sorted_unique(struct llist *list,
145
if (cmp > 0) { /* we insert before this entry */
146
return llist_insert(list, prev, sha1);
147
}
149
- if(!cmp) { /* already exists */
148
+ if (!cmp) { /* already exists */
149
return l;
150
}
151
prev = l;
@@ -168,7 +167,7 @@ redo_from_start:
167
int cmp = hashcmp(l->sha1, sha1);
168
if (cmp > 0) /* not in list, since sorted */
169
return prev;
171
- if(!cmp) { /* found */
170
+ if (!cmp) { /* found */
171
if (prev == NULL) {
172
if (hint != NULL && hint != list->front) {
173
/* we don't know the previous element */
@@ -218,7 +217,7 @@ static inline struct pack_list * pack_list_insert(struct pack_list **pl,
217
static inline size_t pack_list_size(struct pack_list *pl)
218
{
219
size_t ret = 0;
221
- while(pl) {
220
+ while (pl) {
221
ret++;
222
pl = pl->next;
223
}
@@ -396,7 +395,7 @@ static size_t get_pack_redundancy(struct pack_list *pl)
395
return 0;
396
397
while ((subset = pl->next)) {
399
- while(subset) {
398
+ while (subset) {
399
ret += sizeof_union(pl->pack, subset->pack);
400
subset = subset->next;
401
}
@@ -427,7 +426,7 @@ static void minimize(struct pack_list **min)
426
427
pl = local_packs;
428
while (pl) {
430
- if(pl->unique_objects->size)
429
+ if (pl->unique_objects->size)
430
pack_list_insert(&unique, pl);
431
else
432
pack_list_insert(&non_unique, pl);
@@ -479,7 +478,7 @@ static void minimize(struct pack_list **min)
478
*min = min_perm;
479
/* add the unique packs to the list */
480
pl = unique;
482
- while(pl) {
481
+ while (pl) {
482
pack_list_insert(min, pl);
483
pl = pl->next;
484
}
@@ -516,7 +515,7 @@ static void cmp_local_packs(void)
515
struct pack_list *subset, *pl = local_packs;
516
517
while ((subset = pl)) {
519
- while((subset = subset->next))
518
+ while ((subset = subset->next))
519
cmp_two_packs(pl, subset);
520
pl = pl->next;
521
}
@@ -608,23 +607,23 @@ int main(int argc, char **argv)
607
608
for (i = 1; i < argc; i++) {
609
const char *arg = argv[i];
611
- if(!strcmp(arg, "--")) {
610
+ if (!strcmp(arg, "--")) {
611
i++;
612
break;
613
}
615
- if(!strcmp(arg, "--all")) {
614
+ if (!strcmp(arg, "--all")) {
615
load_all_packs = 1;
616
continue;
617
}
619
- if(!strcmp(arg, "--verbose")) {
618
+ if (!strcmp(arg, "--verbose")) {
619
verbose = 1;
620
continue;
621
}
623
- if(!strcmp(arg, "--alt-odb")) {
622
+ if (!strcmp(arg, "--alt-odb")) {
623
alt_odb = 1;
624
continue;
625
}
627
- if(*arg == '-')
626
+ if (*arg == '-')
627
usage(pack_redundant_usage);
628
else
629
break;
remote.c
+1
-1
@@ -1038,7 +1038,7 @@ static int match_explicit(struct ref *src, struct ref *dst,
1038
case 0:
1039
if (!memcmp(dst_value, "refs/", 5))
1040
matched_dst = make_linked_ref(dst_value, dst_tail);
1041
- else if((dst_guess = guess_ref(dst_value, matched_src)))
1041
+ else if ((dst_guess = guess_ref(dst_value, matched_src)))
1042
matched_dst = make_linked_ref(dst_guess, dst_tail);
1043
else
1044
error("unable to push to unqualified destination: %s\n"
upload-pack.c
+1
-1
@@ -427,7 +427,7 @@ static int get_common_commits(void)
427
428
save_commit_buffer = 0;
429
430
- for(;;) {
430
+ for (;;) {
431
int len = packet_read_line(0, line, sizeof(line));
432
reset_timeout();
433
var.c
+2
-3
@@ -21,9 +21,8 @@ static struct git_var git_vars[] = {
21
static void list_vars(void)
22
{
23
struct git_var *ptr;
24
- for(ptr = git_vars; ptr->read; ptr++) {
24
+ for (ptr = git_vars; ptr->read; ptr++)
25
printf("%s=%s\n", ptr->name, ptr->read(IDENT_WARN_ON_NO_NAME));
26
- }
26
}
27
28
static const char *read_var(const char *var)
@@ -31,7 +30,7 @@ static const char *read_var(const char *var)
30
struct git_var *ptr;
31
const char *val;
32
val = NULL;
34
- for(ptr = git_vars; ptr->read; ptr++) {
33
+ for (ptr = git_vars; ptr->read; ptr++) {
34
if (strcmp(var, ptr->name) == 0) {
35
val = ptr->read(IDENT_ERROR_ON_NO_NAME);
36
break;
wt-status.c
+1
-1
@@ -326,7 +326,7 @@ static void wt_status_collect_untracked(struct wt_status *s)
326
setup_standard_excludes(&dir);
327
328
fill_directory(&dir, NULL);
329
- for(i = 0; i < dir.nr; i++) {
329
+ for (i = 0; i < dir.nr; i++) {
330
struct dir_entry *ent = dir.entries[i];
331
if (!cache_name_is_other(ent->name, ent->len))
332
continue;