cgit

commit bdae1d8a8d39206ac75ab86f8e9ef53b2f29432e

Author: Jason A. Donenfeld <Jason@zx2c4.com>

White space around control verbs.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

 cache.c | 6 +++---
 cgit.c | 4 ++--
 cmd.c | 2 +-
 configfile.c | 6 +++---
 html.c | 14 +++++++-------
 parsing.c | 4 ++--
 scan-tree.c | 2 +-
 shared.c | 8 ++++----
 ui-blob.c | 8 ++++----
 ui-diff.c | 2 +-
 ui-refs.c | 4 ++--
 ui-repolist.c | 4 ++--
 ui-shared.c | 12 ++++++------
 ui-snapshot.c | 4 ++--
 ui-stats.c | 2 +-
 ui-tree.c | 2 +-


diff --git a/cache.c b/cache.c
index 6427b69b8e06edc392aef83d6eecb15f6d9a725a..47cdcb44d5ccdfe9bf95c4a8b7af94ded87bfcf4 100644
--- a/cache.c
+++ b/cache.c
@@ -214,7 +214,7 @@
 	if (!s)
 		return h;
 
-	while(*s) {
+	while (*s) {
 		h *= FNV_PRIME;
 		h ^= *s++;
 	}
@@ -342,7 +342,7 @@ 	hash = hash_str(key) % size;
 	strcpy(filename, path);
 	if (filename[len - 1] != '/')
 		filename[len++] = '/';
-	for(i = 0; i < 8; i++) {
+	for (i = 0; i < 8; i++) {
 		sprintf(filename + len++, "%x",
 			(unsigned char)(hash & 0xf));
 		hash >>= 4;
@@ -407,7 +407,7 @@ 		*name++ = '/';
 		*name = '\0';
 	}
 	slot.cache_name = fullname;
-	while((ent = readdir(dir)) != NULL) {
+	while ((ent = readdir(dir)) != NULL) {
 		if (strlen(ent->d_name) != 8)
 			continue;
 		strcpy(name, ent->d_name);




diff --git a/cgit.c b/cgit.c
index 080725848d764af19363d2b922f4b949d8524a2f..ade85ea0976640c49ce71e8a718e5f5c2d7978ac 100644
--- a/cgit.c
+++ b/cgit.c
@@ -315,7 +315,7 @@ 	} else if (!strcmp(name, "name")) {
 		ctx.qry.name = xstrdup(value);
 	} else if (!strcmp(name, "mimetype")) {
 		ctx.qry.mimetype = xstrdup(value);
-	} else if (!strcmp(name, "s")){
+	} else if (!strcmp(name, "s")) {
 		ctx.qry.sort = xstrdup(value);
 	} else if (!strcmp(name, "showmsg")) {
 		ctx.qry.showmsg = atoi(value);
@@ -653,7 +653,7 @@ void print_repolist(FILE *f, struct cgit_repolist *list, int start)
 {
 	int i;
 
-	for(i = start; i < list->count; i++)
+	for (i = start; i < list->count; i++)
 		print_repo(f, &list->repos[i]);
 }
 




diff --git a/cmd.c b/cmd.c
index 899e913b30967d4b4e1d3aa8a770dae148ab60ce..198bf2fda549753dca3f4159c6680e00c49b5948 100644
--- a/cmd.c
+++ b/cmd.c
@@ -166,7 +166,7 @@ 		else
 			ctx->qry.page = "repolist";
 	}
 
-	for(i = 0; i < sizeof(cmds)/sizeof(*cmds); i++)
+	for (i = 0; i < sizeof(cmds)/sizeof(*cmds); i++)
 		if (!strcmp(ctx->qry.page, cmds[i].name))
 			return &cmds[i];
 	return NULL;




diff --git a/configfile.c b/configfile.c
index fe5f9c56df603f88f96816e8e4f128e7aedfd884..3fa217f921b56a670a7ddd4049cdb6180f68a1c7 100644
--- a/configfile.c
+++ b/configfile.c
@@ -27,7 +27,7 @@ void skip_line(FILE *f)
 {
 	int c;
 
-	while((c = next_char(f)) && c != '\n' && c != EOF)
+	while ((c = next_char(f)) && c != '\n' && c != EOF)
 		;
 }
 
@@ -36,7 +36,7 @@ {
 	int i = 0, isname = 0;
 
 	*value = NULL;
-	while(i < bufsize - 1) {
+	while (i < bufsize - 1) {
 		int c = next_char(f);
 		if (!isname && (c == '#' || c == ';')) {
 			skip_line(f);
@@ -78,7 +78,7 @@ 		return -1;
 	if (!(f = fopen(filename, "r")))
 		return -1;
 	nesting++;
-	while((len = read_config_line(f, line, &value, sizeof(line))) > 0)
+	while ((len = read_config_line(f, line, &value, sizeof(line))) > 0)
 		fn(line, value);
 	nesting--;
 	fclose(f);




diff --git a/html.c b/html.c
index ed6cefcfea307f10e2fb72fe00b12f1e42b09c30..90cc1c0099198da575119e0b0f38fa3db478f785 100644
--- a/html.c
+++ b/html.c
@@ -92,7 +92,7 @@
 void html_txt(const char *txt)
 {
 	const char *t = txt;
-	while(t && *t){
+	while (t && *t) {
 		int c = *t;
 		if (c == '<' || c == '>' || c == '&') {
 			html_raw(txt, t - txt);
@@ -113,7 +113,7 @@
 void html_ntxt(int len, const char *txt)
 {
 	const char *t = txt;
-	while(t && *t && len--){
+	while (t && *t && len--) {
 		int c = *t;
 		if (c == '<' || c == '>' || c == '&') {
 			html_raw(txt, t - txt);
@@ -136,7 +136,7 @@
 void html_attr(const char *txt)
 {
 	const char *t = txt;
-	while(t && *t){
+	while (t && *t) {
 		int c = *t;
 		if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&') {
 			html_raw(txt, t - txt);
@@ -161,7 +161,7 @@
 void html_url_path(const char *txt)
 {
 	const char *t = txt;
-	while(t && *t){
+	while (t && *t) {
 		unsigned char c = *t;
 		const char *e = url_escape_table[c];
 		if (e && c != '+' && c != '&') {
@@ -178,7 +178,7 @@
 void html_url_arg(const char *txt)
 {
 	const char *t = txt;
-	while(t && *t){
+	while (t && *t) {
 		unsigned char c = *t;
 		const char *e = url_escape_table[c];
 		if (c == ' ')
@@ -260,7 +260,7 @@ 		fprintf(stderr, "[cgit] Failed to include file %s: %s (%d).\n",
 			filename, strerror(errno), errno);
 		return -1;
 	}
-	while((len = fread(buf, 1, 4096, f)) > 0)
+	while ((len = fread(buf, 1, 4096, f)) > 0)
 		html_raw(buf, len);
 	fclose(f);
 	return 0;
@@ -310,7 +310,7 @@ 	if (t == NULL) {
 		printf("Out of memory\n");
 		exit(1);
 	}
-	while((c=*t) != '\0') {
+	while ((c=*t) != '\0') {
 		if (c == '=') {
 			*t = '\0';
 			value = t + 1;




diff --git a/parsing.c b/parsing.c
index 1b2a551417f621733eaa4c5bbe2d5e8bf3de75dc..9b7efb31260658948bfae8374488bd673c815e16 100644
--- a/parsing.c
+++ b/parsing.c
@@ -112,7 +112,7 @@ 	if (!*txt || !src_enc || !dst_enc)
 		return *txt;
 
 	/* no encoding needed if src_enc equals dst_enc */
-	if(!strcasecmp(src_enc, dst_enc))
+	if (!strcasecmp(src_enc, dst_enc))
 		return *txt;
 
 	tmp = reencode_string(*txt, dst_enc, src_enc);
@@ -170,7 +170,7 @@ 		}
 	}
 
 	/* if no special encoding is found, assume UTF-8 */
-	if(!ret->msg_encoding)
+	if (!ret->msg_encoding)
 		ret->msg_encoding = xstrdup("UTF-8");
 
 	// skip unknown header fields




diff --git a/scan-tree.c b/scan-tree.c
index 98a99c91d99e94a2fe0407329e4ec91f102417d3..10d90f49a5debc4361162b2b873dfd645bc13d6f 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -185,7 +185,7 @@ 	if (is_git_dir(fmt("%s/.git", path))) {
 		add_repo(base, fmt("%s/.git", path), fn);
 		goto end;
 	}
-	while((ent = readdir(dir)) != NULL) {
+	while ((ent = readdir(dir)) != NULL) {
 		if (ent->d_name[0] == '.') {
 			if (ent->d_name[1] == '\0')
 				continue;




diff --git a/shared.c b/shared.c
index 01800b6a2ed6291efccf2a2e577d63a1829955e4..e732064afdb40b223dc21e73f25fe84a45a76127 100644
--- a/shared.c
+++ b/shared.c
@@ -108,7 +108,7 @@
 	if (str == NULL)
 		return NULL;
 	len = strlen(str);
-	while(len > 0 && str[len - 1] == c)
+	while (len > 0 && str[len - 1] == c)
 		len--;
 	if (len == 0)
 		return NULL;
@@ -351,16 +351,16 @@ 	static const char *delim = " \t,:/|;";
 	int tl, sl, rv = 0;
 
 	/* favor legacy setting */
-	if(atoi(str))
+	if (atoi(str))
 		return 1;
-	for(;;) {
+	for (;;) {
 		str += strspn(str, delim);
 		tl = strcspn(str, delim);
 		if (!tl)
 			break;
 		for (f = cgit_snapshot_formats; f->suffix; f++) {
 			sl = strlen(f->suffix);
-			if((tl == sl && !strncmp(f->suffix, str, tl)) ||
+			if ((tl == sl && !strncmp(f->suffix, str, tl)) ||
 			   (tl == sl - 1 && !strncmp(f->suffix + 1, str, tl - 1))) {
 				rv |= f->bit;
 				break;




diff --git a/ui-blob.c b/ui-blob.c
index 6d529f1d2b2c88432008cdf920d7f20874a3e09d..d382ba3202604b04be2c3d515825b8c524b64dd7 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -17,7 +17,7 @@ static int found_path;
 
 static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
 	const char *pathname, unsigned mode, int stage, void *cbdata) {
-	if(strncmp(base, match_path, baselen)
+	if (strncmp(base, match_path, baselen)
 		|| strcmp(match_path + baselen, pathname))
 		return READ_TREE_RECURSIVE;
 	memmove(matched_sha1, sha1, 20);
@@ -43,7 +43,7 @@ 	};
 	if (get_sha1(head, sha1))
 		return -1;
 	type = sha1_object_info(sha1, &size);
-	if(type == OBJ_COMMIT && path) {
+	if (type == OBJ_COMMIT && path) {
 		commit = lookup_commit_reference(sha1);
 		match_path = path;
 		matched_sha1 = sha1;
@@ -80,7 +80,7 @@ 		.items = &path_items
 	};
 
 	if (hex) {
-		if (get_sha1_hex(hex, sha1)){
+		if (get_sha1_hex(hex, sha1)) {
 			cgit_print_error(fmt("Bad hex value: %s", hex));
 			return;
 		}
@@ -93,7 +93,7 @@ 	}
 
 	type = sha1_object_info(sha1, &size);
 
-	if((!hex) && type == OBJ_COMMIT && path) {
+	if ((!hex) && type == OBJ_COMMIT && path) {
 		commit = lookup_commit_reference(sha1);
 		match_path = path;
 		matched_sha1 = sha1;




diff --git a/ui-diff.c b/ui-diff.c
index 3d46da2e6d08d627034c3ee854fd99c39911306d..49e5b468f4385605efed4cec567e3e016f501379 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -184,7 +184,7 @@ 	html("");
 	max_changes = 0; 	cgit_diff_tree(old_sha1, new_sha1, inspect_filepair, prefix, 		       ctx.qry.ignorews);-	for(i = 0; i<files; i++)+	for (i = 0; i<files; i++) 		print_fileinfo(&items[i]); 	html("</table>"); 	html("<div class='diffstat-summary'>");




diff --git a/ui-refs.c b/ui-refs.c
index 3827252f8120a8ceddd6877198e77d3aa8866876..ce06b089808b524f30ff4027f32be0182fc215c5 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -200,7 +200,7 @@ 		qsort(list.refs, list.count, sizeof(*list.refs), cmp_branch_age);
 		qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name); 	} -	for(i = 0; i < maxcount; i++)+	for (i = 0; i < maxcount; i++) 		print_branch(list.refs[i]);  	if (maxcount < list.count)
@@ -224,7 +224,7 @@ 		maxcount = list.count;
 	else if (maxcount > list.count) 		maxcount = list.count; 	print_tag_header();-	for(i = 0; i < maxcount; i++)+	for (i = 0; i < maxcount; i++) 		print_tag(list.refs[i]);  	if (maxcount < list.count)




diff --git a/ui-repolist.c b/ui-repolist.c
index 449478da2a38ce1d71e12cdfe43a5dbe6440dfea..1ae22aaa7e192e9b595118117f19c5f75f3e2219 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -129,7 +129,7 @@ {
 	int i, ofs; 	char *class = NULL; 	html("<div class='pager'>");-	for(i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) {+	for (i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) { 		class = (ctx.qry.ofs == ofs) ? "current" : NULL; 		cgit_index_link(fmt("[%d]", i + 1), fmt("Page %d", i + 1), 				class, search, sort, ofs);
@@ -258,7 +258,7 @@
 	if (ctx.cfg.index_header) 		html_include(ctx.cfg.index_header); -	if(ctx.qry.sort)+	if (ctx.qry.sort) 		sorted = sort_repolist(ctx.qry.sort); 	else if (ctx.cfg.section_sort) 		sort_repolist("section");




diff --git a/ui-shared.c b/ui-shared.c
index 1a28dce668ca67b30fb222ccb73e0f8e422eea0c..af5310bb362e207a5970c61ec53716dac9ebd2c7 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -103,20 +103,20 @@ 	static char rvbuf[1024];
 	int p; 	const char *rv; 	strncpy(rvbuf, reponame, sizeof(rvbuf));-	if(rvbuf[sizeof(rvbuf)-1])+	if (rvbuf[sizeof(rvbuf)-1]) 		die("cgit_repobasename: truncated repository name '%s'", reponame); 	p = strlen(rvbuf)-1; 	/* strip trailing slashes */-	while(p && rvbuf[p] == '/') rvbuf[p--] = 0;+	while (p && rvbuf[p] == '/') rvbuf[p--] = 0; 	/* strip trailing .git */-	if(p >= 3 && !strncmp(&rvbuf[p-3], ".git", 4)) {+	if (p >= 3 && !strncmp(&rvbuf[p-3], ".git", 4)) { 		p -= 3; rvbuf[p--] = 0; 	} 	/* strip more trailing slashes if any */-	while( p && rvbuf[p] == '/') rvbuf[p--] = 0;+	while ( p && rvbuf[p] == '/') rvbuf[p--] = 0; 	/* find last slash in the remaining string */ 	rv = strrchr(rvbuf,'/');-	if(rv)+	if (rv) 		return ++rv; 	return rvbuf; }
@@ -576,7 +576,7 @@ 	struct tm *time;
  	if (!secs) 		return;-	if(local_time)+	if (local_time) 		time = localtime(&secs); 	else 		time = gmtime(&secs);




diff --git a/ui-snapshot.c b/ui-snapshot.c
index 7374d9d851ca70fb4d53e3d1fd22426d9c9f48e5..281899de0b01222d1e9453c3ca7385151334fec9 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -72,7 +72,7 @@ 	{ ".tar.gz", "application/x-gzip", write_tar_gzip_archive, 0x02 },
 	{ ".tar.bz2", "application/x-bzip2", write_tar_bzip2_archive, 0x04 }, 	{ ".tar", "application/x-tar", write_tar_archive, 0x08 }, 	{ ".tar.xz", "application/x-xz", write_tar_xz_archive, 0x10 },-	{}+	{ NULL } };  static const struct cgit_snapshot_format *get_format(const char *filename)
@@ -81,7 +81,7 @@ 	const struct cgit_snapshot_format *fmt;
 	int fl, sl;  	fl = strlen(filename);-	for(fmt = cgit_snapshot_formats; fmt->suffix; fmt++) {+	for (fmt = cgit_snapshot_formats; fmt->suffix; fmt++) { 		sl = strlen(fmt->suffix); 		if (sl >= fl) 			continue;




diff --git a/ui-stats.c b/ui-stats.c
index f74dc3337bb1cc47df376561dc97848bf93c7f7b..9cf1dbdc89fbd40286404289018571c319d7cd0e 100644
--- a/ui-stats.c
+++ b/ui-stats.c
@@ -83,7 +83,7 @@
 static void trunc_quarter(struct tm *tm) { 	trunc_month(tm);-	while(tm->tm_mon % 3 != 0)+	while (tm->tm_mon % 3 != 0) 		dec_month(tm); } 




diff --git a/ui-tree.c b/ui-tree.c
index 4d7b2617ed0c8ae924a860acd4ec4164b10d73d2..4d932a0fbdcd82ba14a449e3f731931f8907542c 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -30,7 +30,7 @@ 		lineno = 0;
  		if (size) { 			htmlf(numberfmt, ++lineno);-			while(idx < size - 1) { // skip absolute last newline+			while (idx < size - 1) { // skip absolute last newline 				if (buf[idx] == '\n') 					htmlf(numberfmt, ++lineno); 				idx++;