diff options
| author | 2013-03-04 00:04:29 (JST) | |
|---|---|---|
| committer | 2013-03-04 09:12:48 (JST) | |
| commit | 53bc747d311d18642fa3ad0cc0de34f3899ed1f4 (patch) | |
| tree | 97e6fa2e4e7300f55a180917059b71e566c260fe | |
| parent | 7f4e8c33aeb65bdc5695c9fd13ec1ceb100303c7 (diff) | |
| download | cgit-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.c | 6 | ||||
| -rw-r--r-- | cgit.c | 18 | ||||
| -rw-r--r-- | configfile.c | 22 | ||||
| -rw-r--r-- | html.c | 78 | ||||
| -rw-r--r-- | scan-tree.c | 4 | ||||
| -rw-r--r-- | shared.c | 14 | ||||
| -rw-r--r-- | ui-blob.c | 10 | ||||
| -rw-r--r-- | ui-commit.c | 4 | ||||
| -rw-r--r-- | ui-refs.c | 4 | ||||
| -rw-r--r-- | ui-repolist.c | 6 | ||||
| -rw-r--r-- | ui-shared.c | 18 | ||||
| -rw-r--r-- | ui-stats.c | 8 | ||||
| -rw-r--r-- | ui-tag.c | 2 | ||||
| -rw-r--r-- | ui-tree.c | 4 |
14 files changed, 99 insertions, 99 deletions
| @@ -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 | */ |
| 142 | static int lock_slot(struct cache_slot *slot) | 142 | static 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) |
| @@ -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 @@ | |||
| 13 | int next_char(FILE *f) | 13 | int 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 | ||
| @@ -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(">"); | 100 | html(">"); |
| 101 | else if (c=='<') | 101 | else if (c == '<') |
| 102 | html("<"); | 102 | html("<"); |
| 103 | else if (c=='&') | 103 | else if (c == '&') |
| 104 | html("&"); | 104 | html("&"); |
| 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(">"); | 121 | html(">"); |
| 122 | else if (c=='<') | 122 | else if (c == '<') |
| 123 | html("<"); | 123 | html("<"); |
| 124 | else if (c=='&') | 124 | else if (c == '&') |
| 125 | html("&"); | 125 | html("&"); |
| 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); | ||
