aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Lukas Fleischer <cgit@cryptocrack.de>2013-03-04 00:04:29 (JST)
committerGravatar Lukas Fleischer <cgit@cryptocrack.de>2013-03-04 09:12:48 (JST)
commit53bc747d311d18642fa3ad0cc0de34f3899ed1f4 (patch)
tree97e6fa2e4e7300f55a180917059b71e566c260fe
parent7f4e8c33aeb65bdc5695c9fd13ec1ceb100303c7 (diff)
downloadcgit-53bc747d311d18642fa3ad0cc0de34f3899ed1f4.zip
cgit-53bc747d311d18642fa3ad0cc0de34f3899ed1f4.tar.gz
Fix several whitespace errors
* Remove whitespace at the end of lines. * Replace space indentation by tabs. * Add whitespace before/after several operators ("+", "-", "*", ...) * Add whitespace to assignments ("foo = bar;"). * Fix whitespace in parameter lists ("foobar(foo, bar, 42)"). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
-rw-r--r--cache.c6
-rw-r--r--cgit.c18
-rw-r--r--configfile.c22
-rw-r--r--html.c78
-rw-r--r--scan-tree.c4
-rw-r--r--shared.c14
-rw-r--r--ui-blob.c10
-rw-r--r--ui-commit.c4
-rw-r--r--ui-refs.c4
-rw-r--r--ui-repolist.c6
-rw-r--r--ui-shared.c18
-rw-r--r--ui-stats.c8
-rw-r--r--ui-tag.c2
-rw-r--r--ui-tree.c4
14 files changed, 99 insertions, 99 deletions
diff --git a/cache.c b/cache.c
index d7a8d5a..6427b69 100644
--- a/cache.c
+++ b/cache.c
@@ -105,7 +105,7 @@ static int is_expired(struct cache_slot *slot)
105 if (slot->ttl < 0) 105 if (slot->ttl < 0)
106 return 0; 106 return 0;
107 else 107 else
108 return slot->cache_st.st_mtime + slot->ttl*60 < time(NULL); 108 return slot->cache_st.st_mtime + slot->ttl * 60 < time(NULL);
109} 109}
110 110
111/* Check if the slot has been modified since we opened it. 111/* Check if the slot has been modified since we opened it.
@@ -141,8 +141,8 @@ static int close_lock(struct cache_slot *slot)
141 */ 141 */
142static int lock_slot(struct cache_slot *slot) 142static int lock_slot(struct cache_slot *slot)
143{ 143{
144 slot->lock_fd = open(slot->lock_name, O_RDWR|O_CREAT|O_EXCL, 144 slot->lock_fd = open(slot->lock_name, O_RDWR | O_CREAT | O_EXCL,
145 S_IRUSR|S_IWUSR); 145 S_IRUSR | S_IWUSR);
146 if (slot->lock_fd == -1) 146 if (slot->lock_fd == -1)
147 return errno; 147 return errno;
148 if (xwrite(slot->lock_fd, slot->key, slot->keylen + 1) < 0) 148 if (xwrite(slot->lock_fd, slot->key, slot->keylen + 1) < 0)
diff --git a/cgit.c b/cgit.c
index d615315..0807258 100644
--- a/cgit.c
+++ b/cgit.c
@@ -741,7 +741,7 @@ static void cgit_parse_args(int argc, const char **argv)
741 741
742 for (i = 1; i < argc; i++) { 742 for (i = 1; i < argc; i++) {
743 if (!strncmp(argv[i], "--cache=", 8)) { 743 if (!strncmp(argv[i], "--cache=", 8)) {
744 ctx.cfg.cache_root = xstrdup(argv[i]+8); 744 ctx.cfg.cache_root = xstrdup(argv[i] + 8);
745 } 745 }
746 if (!strcmp(argv[i], "--nocache")) { 746 if (!strcmp(argv[i], "--nocache")) {
747 ctx.cfg.nocache = 1; 747 ctx.cfg.nocache = 1;
@@ -750,24 +750,24 @@ static void cgit_parse_args(int argc, const char **argv)
750 ctx.env.no_http = "1"; 750 ctx.env.no_http = "1";
751 } 751 }
752 if (!strncmp(argv[i], "--query=", 8)) { 752 if (!strncmp(argv[i], "--query=", 8)) {
753 ctx.qry.raw = xstrdup(argv[i]+8); 753 ctx.qry.raw = xstrdup(argv[i] + 8);
754 } 754 }
755 if (!strncmp(argv[i], "--repo=", 7)) { 755 if (!strncmp(argv[i], "--repo=", 7)) {
756 ctx.qry.repo = xstrdup(argv[i]+7); 756 ctx.qry.repo = xstrdup(argv[i] + 7);
757 } 757 }
758 if (!strncmp(argv[i], "--page=", 7)) { 758 if (!strncmp(argv[i], "--page=", 7)) {
759 ctx.qry.page = xstrdup(argv[i]+7); 759 ctx.qry.page = xstrdup(argv[i] + 7);
760 } 760 }
761 if (!strncmp(argv[i], "--head=", 7)) { 761 if (!strncmp(argv[i], "--head=", 7)) {
762 ctx.qry.head = xstrdup(argv[i]+7); 762 ctx.qry.head = xstrdup(argv[i] + 7);
763 ctx.qry.has_symref = 1; 763 ctx.qry.has_symref = 1;
764 } 764 }
765 if (!strncmp(argv[i], "--sha1=", 7)) { 765 if (!strncmp(argv[i], "--sha1=", 7)) {
766 ctx.qry.sha1 = xstrdup(argv[i]+7); 766 ctx.qry.sha1 = xstrdup(argv[i] + 7);
767 ctx.qry.has_sha1 = 1; 767 ctx.qry.has_sha1 = 1;
768 } 768 }
769 if (!strncmp(argv[i], "--ofs=", 6)) { 769 if (!strncmp(argv[i], "--ofs=", 6)) {
770 ctx.qry.ofs = atoi(argv[i]+6); 770 ctx.qry.ofs = atoi(argv[i] + 6);
771 } 771 }
772 if (!strncmp(argv[i], "--scan-tree=", 12) || 772 if (!strncmp(argv[i], "--scan-tree=", 12) ||
773 !strncmp(argv[i], "--scan-path=", 12)) { 773 !strncmp(argv[i], "--scan-path=", 12)) {
@@ -834,7 +834,7 @@ int main(int argc, const char **argv)
834 ctx.cfg.virtual_root = trim_end(ctx.cfg.script_name, '/'); 834 ctx.cfg.virtual_root = trim_end(ctx.cfg.script_name, '/');
835 if (!ctx.cfg.virtual_root) 835 if (!ctx.cfg.virtual_root)
836 ctx.cfg.virtual_root = ""; 836 ctx.cfg.virtual_root = "";
837 } 837 }
838 838
839 /* If no url parameter is specified on the querystring, lets 839 /* If no url parameter is specified on the querystring, lets
840 * use PATH_INFO as url. This allows cgit to work with virtual 840 * use PATH_INFO as url. This allows cgit to work with virtual
@@ -856,7 +856,7 @@ int main(int argc, const char **argv)
856 } 856 }
857 857
858 ttl = calc_ttl(); 858 ttl = calc_ttl();
859 ctx.page.expires += ttl*60; 859 ctx.page.expires += ttl * 60;
860 if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD")) 860 if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))
861 ctx.cfg.nocache = 1; 861 ctx.cfg.nocache = 1;
862 if (ctx.cfg.nocache) 862 if (ctx.cfg.nocache)
diff --git a/configfile.c b/configfile.c
index 4908058..fe5f9c5 100644
--- a/configfile.c
+++ b/configfile.c
@@ -13,9 +13,9 @@
13int next_char(FILE *f) 13int next_char(FILE *f)
14{ 14{
15 int c = fgetc(f); 15 int c = fgetc(f);
16 if (c=='\r') { 16 if (c == '\r') {
17 c = fgetc(f); 17 c = fgetc(f);
18 if (c!='\n') { 18 if (c != '\n') {
19 ungetc(c, f); 19 ungetc(c, f);
20 c = '\r'; 20 c = '\r';
21 } 21 }
@@ -27,7 +27,7 @@ void skip_line(FILE *f)
27{ 27{
28 int c; 28 int c;
29 29
30 while((c=next_char(f)) && c!='\n' && c!=EOF) 30 while((c = next_char(f)) && c != '\n' && c != EOF)
31 ; 31 ;
32} 32}
33 33
@@ -36,31 +36,31 @@ int read_config_line(FILE *f, char *line, const char **value, int bufsize)
36 int i = 0, isname = 0; 36 int i = 0, isname = 0;
37 37
38 *value = NULL; 38 *value = NULL;
39 while(i<bufsize-1) { 39 while(i < bufsize - 1) {
40 int c = next_char(f); 40 int c = next_char(f);
41 if (!isname && (c=='#' || c==';')) { 41 if (!isname && (c == '#' || c == ';')) {
42 skip_line(f); 42 skip_line(f);
43 continue; 43 continue;
44 } 44 }
45 if (!isname && isspace(c)) 45 if (!isname && isspace(c))
46 continue; 46 continue;
47 47
48 if (c=='=' && !*value) { 48 if (c == '=' && !*value) {
49 line[i] = 0; 49 line[i] = 0;
50 *value = &line[i+1]; 50 *value = &line[i + 1];
51 } else if (c=='\n' && !isname) { 51 } else if (c == '\n' && !isname) {
52 i = 0; 52 i = 0;
53 continue; 53 continue;
54 } else if (c=='\n' || c==EOF) { 54 } else if (c == '\n' || c == EOF) {
55 line[i] = 0; 55 line[i] = 0;
56 break; 56 break;
57 } else { 57 } else {
58 line[i]=c; 58 line[i] = c;
59 } 59 }
60 isname = 1; 60 isname = 1;
61 i++; 61 i++;
62 } 62 }
63 line[i+1] = 0; 63 line[i + 1] = 0;
64 return i; 64 return i;
65} 65}
66 66
diff --git a/html.c b/html.c
index 8f6e4f6..ed6cefc 100644
--- a/html.c
+++ b/html.c
@@ -54,7 +54,7 @@ char *fmt(const char *format, ...)
54 va_start(args, format); 54 va_start(args, format);
55 len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args); 55 len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args);
56 va_end(args); 56 va_end(args);
57 if (len>sizeof(buf[bufidx])) { 57 if (len > sizeof(buf[bufidx])) {
58 fprintf(stderr, "[html.c] string truncated: %s\n", format); 58 fprintf(stderr, "[html.c] string truncated: %s\n", format);
59 exit(1); 59 exit(1);
60 } 60 }
@@ -94,19 +94,19 @@ void html_txt(const char *txt)
94 const char *t = txt; 94 const char *t = txt;
95 while(t && *t){ 95 while(t && *t){
96 int c = *t; 96 int c = *t;
97 if (c=='<' || c=='>' || c=='&') { 97 if (c == '<' || c == '>' || c == '&') {
98 html_raw(txt, t - txt); 98 html_raw(txt, t - txt);
99 if (c=='>') 99 if (c == '>')
100 html("&gt;"); 100 html("&gt;");
101 else if (c=='<') 101 else if (c == '<')
102 html("&lt;"); 102 html("&lt;");
103 else if (c=='&') 103 else if (c == '&')
104 html("&amp;"); 104 html("&amp;");
105 txt = t+1; 105 txt = t + 1;
106 } 106 }
107 t++; 107 t++;
108 } 108 }
109 if (t!=txt) 109 if (t != txt)
110 html(txt); 110 html(txt);
111} 111}
112 112
@@ -115,21 +115,21 @@ void html_ntxt(int len, const char *txt)
115 const char *t = txt; 115 const char *t = txt;
116 while(t && *t && len--){ 116 while(t && *t && len--){
117 int c = *t; 117 int c = *t;
118 if (c=='<' || c=='>' || c=='&') { 118 if (c == '<' || c == '>' || c == '&') {
119 html_raw(txt, t - txt); 119 html_raw(txt, t - txt);
120 if (c=='>') 120 if (c == '>')
121 html("&gt;"); 121 html("&gt;");
122 else if (c=='<') 122 else if (c == '<')
123 html("&lt;"); 123 html("&lt;");
124 else if (c=='&') 124 else if (c == '&')
125 html("&amp;"); 125 html("&amp;");
126 txt = t+1; 126 txt = t + 1;
127 } 127 }
128 t++; 128 t++;
129 } 129 }
130 if (t!=txt) 130 if (t != txt)
131 html_raw(txt, t - txt); 131 html_raw(txt, t - txt);
132 if (len<0) 132 if (len < 0)
133 html("..."); 133 html("...");
134} 134}
135 135
@@ -138,23 +138,23 @@ void html_attr(const char *txt)
138 const char *t = txt; 138 const char *t = txt;
139 while(t && *t){ 139 while(t && *t){
140 int c = *t; 140 int c = *t;
141 if (c=='<' || c=='>' || c=='\'' || c=='\"' || c=='&') { 141 if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&') {
142 html_raw(txt, t - txt); 142 html_raw(txt, t - txt);
143 if (c=='>') 143 if (c == '>')
144 html("&gt;"); 144 html("&gt;");
145 else if (c=='<') 145 else if (c == '<')
146 html("&lt;"); 146 html("&lt;");
147 else if (c=='\'') 147 else if (c == '\'')
148 html("&#x27;"); 148 html("&#x27;");
149 else if (c=='"') 149 else if (c == '"')
150 html("&quot;"); 150 html("&quot;");
151 else if (c=='&') 151 else if (c == '&')
152 html("&amp;"); 152 html("&amp;");
153 txt = t+1; 153 txt = t + 1;
154 } 154 }
155 t++; 155 t++;
156 } 156 }
157 if (t!=txt) 157 if (t != txt)
158 html(txt); 158 html(txt);
159} 159}
160 160
@@ -164,14 +164,14 @@ void html_url_path(const char *txt)
164 while(t && *t){ 164 while(t && *t){
165 unsigned char c = *t; 165 unsigned char c = *t;
166 const char *e = url_escape_table[c]; 166 const char *e = url_escape_table[c];
167 if (e && c!='+' && c!='&') { 167 if (e && c != '+' && c != '&') {
168 html_raw(txt, t - txt); 168 html_raw(txt, t - txt);
169 html(e); 169 html(e);
170 txt = t+1; 170 txt = t + 1;
171 } 171 }
172 t++; 172 t++;
173 } 173 }
174 if (t!=txt) 174 if (t != txt)
175 html(txt); 175 html(txt);
176} 176}
177 177
@@ -186,11 +186,11 @@ void html_url_arg(const char *txt)
186 if (e) { 186 if (e) {
187 html_raw(txt, t - txt);