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>
This commit is contained in:
bovenliggende
7f4e8c33ae
commit
53bc747d31
6
cache.c
6
cache.c
@ -105,7 +105,7 @@ static int is_expired(struct cache_slot *slot)
|
||||
if (slot->ttl < 0)
|
||||
return 0;
|
||||
else
|
||||
return slot->cache_st.st_mtime + slot->ttl*60 < time(NULL);
|
||||
return slot->cache_st.st_mtime + slot->ttl * 60 < time(NULL);
|
||||
}
|
||||
|
||||
/* Check if the slot has been modified since we opened it.
|
||||
@ -141,8 +141,8 @@ static int close_lock(struct cache_slot *slot)
|
||||
*/
|
||||
static int lock_slot(struct cache_slot *slot)
|
||||
{
|
||||
slot->lock_fd = open(slot->lock_name, O_RDWR|O_CREAT|O_EXCL,
|
||||
S_IRUSR|S_IWUSR);
|
||||
slot->lock_fd = open(slot->lock_name, O_RDWR | O_CREAT | O_EXCL,
|
||||
S_IRUSR | S_IWUSR);
|
||||
if (slot->lock_fd == -1)
|
||||
return errno;
|
||||
if (xwrite(slot->lock_fd, slot->key, slot->keylen + 1) < 0)
|
||||
|
18
cgit.c
18
cgit.c
@ -741,7 +741,7 @@ static void cgit_parse_args(int argc, const char **argv)
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strncmp(argv[i], "--cache=", 8)) {
|
||||
ctx.cfg.cache_root = xstrdup(argv[i]+8);
|
||||
ctx.cfg.cache_root = xstrdup(argv[i] + 8);
|
||||
}
|
||||
if (!strcmp(argv[i], "--nocache")) {
|
||||
ctx.cfg.nocache = 1;
|
||||
@ -750,24 +750,24 @@ static void cgit_parse_args(int argc, const char **argv)
|
||||
ctx.env.no_http = "1";
|
||||
}
|
||||
if (!strncmp(argv[i], "--query=", 8)) {
|
||||
ctx.qry.raw = xstrdup(argv[i]+8);
|
||||
ctx.qry.raw = xstrdup(argv[i] + 8);
|
||||
}
|
||||
if (!strncmp(argv[i], "--repo=", 7)) {
|
||||
ctx.qry.repo = xstrdup(argv[i]+7);
|
||||
ctx.qry.repo = xstrdup(argv[i] + 7);
|
||||
}
|
||||
if (!strncmp(argv[i], "--page=", 7)) {
|
||||
ctx.qry.page = xstrdup(argv[i]+7);
|
||||
ctx.qry.page = xstrdup(argv[i] + 7);
|
||||
}
|
||||
if (!strncmp(argv[i], "--head=", 7)) {
|
||||
ctx.qry.head = xstrdup(argv[i]+7);
|
||||
ctx.qry.head = xstrdup(argv[i] + 7);
|
||||
ctx.qry.has_symref = 1;
|
||||
}
|
||||
if (!strncmp(argv[i], "--sha1=", 7)) {
|
||||
ctx.qry.sha1 = xstrdup(argv[i]+7);
|
||||
ctx.qry.sha1 = xstrdup(argv[i] + 7);
|
||||
ctx.qry.has_sha1 = 1;
|
||||
}
|
||||
if (!strncmp(argv[i], "--ofs=", 6)) {
|
||||
ctx.qry.ofs = atoi(argv[i]+6);
|
||||
ctx.qry.ofs = atoi(argv[i] + 6);
|
||||
}
|
||||
if (!strncmp(argv[i], "--scan-tree=", 12) ||
|
||||
!strncmp(argv[i], "--scan-path=", 12)) {
|
||||
@ -834,7 +834,7 @@ int main(int argc, const char **argv)
|
||||
ctx.cfg.virtual_root = trim_end(ctx.cfg.script_name, '/');
|
||||
if (!ctx.cfg.virtual_root)
|
||||
ctx.cfg.virtual_root = "";
|
||||
}
|
||||
}
|
||||
|
||||
/* If no url parameter is specified on the querystring, lets
|
||||
* use PATH_INFO as url. This allows cgit to work with virtual
|
||||
@ -856,7 +856,7 @@ int main(int argc, const char **argv)
|
||||
}
|
||||
|
||||
ttl = calc_ttl();
|
||||
ctx.page.expires += ttl*60;
|
||||
ctx.page.expires += ttl * 60;
|
||||
if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))
|
||||
ctx.cfg.nocache = 1;
|
||||
if (ctx.cfg.nocache)
|
||||
|
22
configfile.c
22
configfile.c
@ -13,9 +13,9 @@
|
||||
int next_char(FILE *f)
|
||||
{
|
||||
int c = fgetc(f);
|
||||
if (c=='\r') {
|
||||
if (c == '\r') {
|
||||
c = fgetc(f);
|
||||
if (c!='\n') {
|
||||
if (c != '\n') {
|
||||
ungetc(c, f);
|
||||
c = '\r';
|
||||
}
|
||||
@ -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,31 +36,31 @@ int read_config_line(FILE *f, char *line, const char **value, int bufsize)
|
||||
int i = 0, isname = 0;
|
||||
|
||||
*value = NULL;
|
||||
while(i<bufsize-1) {
|
||||
while(i < bufsize - 1) {
|
||||
int c = next_char(f);
|
||||
if (!isname && (c=='#' || c==';')) {
|
||||
if (!isname && (c == '#' || c == ';')) {
|
||||
skip_line(f);
|
||||
continue;
|
||||
}
|
||||
if (!isname && isspace(c))
|
||||
continue;
|
||||
|
||||
if (c=='=' && !*value) {
|
||||
if (c == '=' && !*value) {
|
||||
line[i] = 0;
|
||||
*value = &line[i+1];
|
||||
} else if (c=='\n' && !isname) {
|
||||
*value = &line[i + 1];
|
||||
} else if (c == '\n' && !isname) {
|
||||
i = 0;
|
||||
continue;
|
||||
} else if (c=='\n' || c==EOF) {
|
||||
} else if (c == '\n' || c == EOF) {
|
||||
line[i] = 0;
|
||||
break;
|
||||
} else {
|
||||
line[i]=c;
|
||||
line[i] = c;
|
||||
}
|
||||
isname = 1;
|
||||
i++;
|
||||
}
|
||||
line[i+1] = 0;
|
||||
line[i + 1] = 0;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
78
html.c
78
html.c
@ -54,7 +54,7 @@ char *fmt(const char *format, ...)
|
||||
va_start(args, format);
|
||||
len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args);
|
||||
va_end(args);
|
||||
if (len>sizeof(buf[bufidx])) {
|
||||
if (len > sizeof(buf[bufidx])) {
|
||||
fprintf(stderr, "[html.c] string truncated: %s\n", format);
|
||||
exit(1);
|
||||
}
|
||||
@ -94,19 +94,19 @@ void html_txt(const char *txt)
|
||||
const char *t = txt;
|
||||
while(t && *t){
|
||||
int c = *t;
|
||||
if (c=='<' || c=='>' || c=='&') {
|
||||
if (c == '<' || c == '>' || c == '&') {
|
||||
html_raw(txt, t - txt);
|
||||
if (c=='>')
|
||||
if (c == '>')
|
||||
html(">");
|
||||
else if (c=='<')
|
||||
else if (c == '<')
|
||||
html("<");
|
||||
else if (c=='&')
|
||||
else if (c == '&')
|
||||
html("&");
|
||||
txt = t+1;
|
||||
txt = t + 1;
|
||||
}
|
||||
t++;
|
||||
}
|
||||
if (t!=txt)
|
||||
if (t != txt)
|
||||
html(txt);
|
||||
}
|
||||
|
||||
@ -115,21 +115,21 @@ void html_ntxt(int len, const char *txt)
|
||||
const char *t = txt;
|
||||
while(t && *t && len--){
|
||||
int c = *t;
|
||||
if (c=='<' || c=='>' || c=='&') {
|
||||
if (c == '<' || c == '>' || c == '&') {
|
||||
html_raw(txt, t - txt);
|
||||
if (c=='>')
|
||||
if (c == '>')
|
||||
html(">");
|
||||
else if (c=='<')
|
||||
else if (c == '<')
|
||||
html("<");
|
||||
else if (c=='&')
|
||||
else if (c == '&')
|
||||
html("&");
|
||||
txt = t+1;
|
||||
txt = t + 1;
|
||||
}
|
||||
t++;
|
||||
}
|
||||
if (t!=txt)
|
||||
if (t != txt)
|
||||
html_raw(txt, t - txt);
|
||||
if (len<0)
|
||||
if (len < 0)
|
||||
html("...");
|
||||
}
|
||||
|
||||
@ -138,23 +138,23 @@ void html_attr(const char *txt)
|
||||
const char *t = txt;
|
||||
while(t && *t){
|
||||
int c = *t;
|
||||
if (c=='<' || c=='>' || c=='\'' || c=='\"' || c=='&') {
|
||||
if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&') {
|
||||
html_raw(txt, t - txt);
|
||||
if (c=='>')
|
||||
if (c == '>')
|
||||
html(">");
|
||||
else if (c=='<')
|
||||
else if (c == '<')
|
||||
html("<");
|
||||
else if (c=='\'')
|
||||
else if (c == '\'')
|
||||
html("'");
|
||||
else if (c=='"')
|
||||
else if (c == '"')
|
||||
html(""");
|
||||
else if (c=='&')
|
||||
else if (c == '&')
|
||||
html("&");
|
||||
txt = t+1;
|
||||
txt = t + 1;
|
||||
}
|
||||
t++;
|
||||
}
|
||||
if (t!=txt)
|
||||
if (t != txt)
|
||||
html(txt);
|
||||
}
|
||||
|
||||
@ -164,14 +164,14 @@ void html_url_path(const char *txt)
|
||||
while(t && *t){
|
||||
unsigned char c = *t;
|
||||
const char *e = url_escape_table[c];
|
||||
if (e && c!='+' && c!='&') {
|
||||
if (e && c != '+' && c != '&') {
|
||||
html_raw(txt, t - txt);
|
||||
html(e);
|
||||
txt = t+1;
|
||||
txt = t + 1;
|
||||
}
|
||||
t++;
|
||||
}
|
||||
if (t!=txt)
|
||||
if (t != txt)
|
||||
html(txt);
|
||||
}
|
||||
|
||||
@ -186,11 +186,11 @@ void html_url_arg(const char *txt)
|
||||
if (e) {
|
||||
html_raw(txt, t - txt);
|
||||
html(e);
|
||||
txt = t+1;
|
||||
txt = t + 1;
|
||||
}
|
||||
t++;
|
||||
}
|
||||
if (t!=txt)
|
||||
if (t != txt)
|
||||
html(txt);
|
||||
}
|
||||
|
||||
@ -286,14 +286,14 @@ char *convert_query_hexchar(char *txt)
|
||||
*txt = '\0';
|
||||
return txt-1;
|
||||
}
|
||||
d1 = hextoint(*(txt+1));
|
||||
d2 = hextoint(*(txt+2));
|
||||
if (d1<0 || d2<0) {
|
||||
memmove(txt, txt+3, n-2);
|
||||
d1 = hextoint(*(txt + 1));
|
||||
d2 = hextoint(*(txt + 2));
|
||||
if (d1 < 0 || d2 < 0) {
|
||||
memmove(txt, txt + 3, n - 2);
|
||||
return txt-1;
|
||||
} else {
|
||||
*txt = d1 * 16 + d2;
|
||||
memmove(txt+1, txt+3, n-2);
|
||||
memmove(txt + 1, txt + 3, n - 2);
|
||||
return txt;
|
||||
}
|
||||
}
|
||||
@ -311,22 +311,22 @@ int http_parse_querystring(const char *txt_, void (*fn)(const char *name, const
|
||||
exit(1);
|
||||
}
|
||||
while((c=*t) != '\0') {
|
||||
if (c=='=') {
|
||||
if (c == '=') {
|
||||
*t = '\0';
|
||||
value = t+1;
|
||||
} else if (c=='+') {
|
||||
value = t + 1;
|
||||
} else if (c == '+') {
|
||||
*t = ' ';
|
||||
} else if (c=='%') {
|
||||
} else if (c == '%') {
|
||||
t = convert_query_hexchar(t);
|
||||
} else if (c=='&') {
|
||||
} else if (c == '&') {
|
||||
*t = '\0';
|
||||
(*fn)(txt, value);
|
||||
txt = t+1;
|
||||
txt = t + 1;
|
||||
value = NULL;
|
||||
}
|
||||
t++;
|
||||
}
|
||||
if (t!=txt)
|
||||
if (t != txt)
|
||||
(*fn)(txt, value);
|
||||
free(o);
|
||||
return 0;
|
||||
|
@ -106,7 +106,7 @@ static void add_repo(const char *base, const char *path, repo_config_fn fn)
|
||||
config_fn = fn;
|
||||
if (ctx.cfg.enable_git_config)
|
||||
git_config_from_file(gitconfig_config, fmt("%s/config", path), NULL);
|
||||
|
||||
|
||||
if (ctx.cfg.remove_suffix)
|
||||
if ((p = strrchr(repo->url, '.')) && !strcmp(p, ".git"))
|
||||
*p = '\0';
|
||||
@ -222,7 +222,7 @@ void scan_projects(const char *path, const char *projectsfile, repo_config_fn fn
|
||||
char line[MAX_PATH * 2], *z;
|
||||
FILE *projects;
|
||||
int err;
|
||||
|
||||
|
||||
projects = fopen(projectsfile, "r");
|
||||
if (!projects) {
|
||||
fprintf(stderr, "Error opening projectsfile %s: %s (%d)\n",
|
||||
|
14
shared.c
14
shared.c
@ -28,8 +28,8 @@ int chk_positive(int result, char *msg)
|
||||
|
||||
int chk_non_negative(int result, char *msg)
|
||||
{
|
||||
if (result < 0)
|
||||
die("%s: %s",msg, strerror(errno));
|
||||
if (result < 0)
|
||||
die("%s: %s", msg, strerror(errno));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ struct cgit_repo *cgit_get_repoinfo(const char *url)
|
||||
int i;
|
||||
struct cgit_repo *repo;
|
||||
|
||||
for (i=0; i<cgit_repolist.count; i++) {
|
||||
for (i = 0; i < cgit_repolist.count; i++) {
|
||||
repo = &cgit_repolist.repos[i];
|
||||
if (!strcmp(repo->url, url))
|
||||
return repo;
|
||||
@ -207,7 +207,7 @@ static int load_mmfile(mmfile_t *file, const unsigned char *sha1)
|
||||
file->ptr = (char *)"";
|
||||
file->size = 0;
|
||||
} else {
|
||||
file->ptr = read_sha1_file(sha1, &type,
|
||||
file->ptr = read_sha1_file(sha1, &type,
|
||||
(unsigned long *)&file->size);
|
||||
}
|
||||
return 1;
|
||||
@ -354,14 +354,14 @@ int cgit_parse_snapshots_mask(const char *str)
|
||||
if(atoi(str))
|
||||
return 1;
|
||||
for(;;) {
|
||||
str += strspn(str,delim);
|
||||
tl = strcspn(str,delim);
|
||||
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)) ||
|
||||
(tl == sl-1 && !strncmp(f->suffix+1, str, tl-1))) {
|
||||
(tl == sl - 1 && !strncmp(f->suffix + 1, str, tl - 1))) {
|
||||
rv |= f->bit;
|
||||
break;
|
||||
}
|
||||
|
10
ui-blob.c
10
ui-blob.c
@ -15,12 +15,12 @@ static char *match_path;
|
||||
static unsigned char *matched_sha1;
|
||||
static int found_path;
|
||||
|
||||
static int walk_tree(const unsigned char *sha1, const char *base,int baselen,
|
||||
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)
|
||||
|| strcmp(match_path+baselen,pathname) )
|
||||
if(strncmp(base, match_path, baselen)
|
||||
|| strcmp(match_path + baselen, pathname))
|
||||
return READ_TREE_RECURSIVE;
|
||||
memmove(matched_sha1,sha1,20);
|
||||
memmove(matched_sha1, sha1, 20);
|
||||
found_path = 1;
|
||||
return 0;
|
||||
}
|
||||
@ -85,7 +85,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head)
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (get_sha1(head,sha1)) {
|
||||
if (get_sha1(head, sha1)) {
|
||||
cgit_print_error(fmt("Bad ref: %s", head));
|
||||
return;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ void cgit_print_commit(char *hex, const char *prefix)
|
||||
format_note(NULL, sha1, ¬es, PAGE_ENCODING, 0);
|
||||
|
||||
load_ref_decorations(DECORATE_FULL_REFS);
|
||||
|
||||
|
||||
cgit_print_diff_ctrls();
|
||||
html("<table summary='commit info' class='commit-info'>\n");
|
||||
html("<tr><th>author</th><td>");
|
||||
@ -75,7 +75,7 @@ void cgit_print_commit(char *hex, const char *prefix)
|
||||
cgit_tree_link(prefix, NULL, NULL, ctx.qry.head, tmp, prefix);
|
||||
}
|
||||
html("</td></tr>\n");
|
||||
for (p = commit->parents; p ; p = p->next) {
|
||||
for (p = commit->parents; p; p = p->next) {
|
||||
parent = lookup_commit_reference(p->item->object.sha1);
|
||||
if (!parent) {
|
||||
html("<tr><td colspan='3'>");
|
||||
|
@ -200,7 +200,7 @@ void cgit_print_branches(int maxcount)
|
||||
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 @@ void cgit_print_tags(int maxcount)
|
||||
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)
|
||||
|
@ -131,8 +131,8 @@ void print_pager(int items, int pagelen, char *search, char *sort)
|
||||
html("<div class='pager'>");
|
||||
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);
|
||||
cgit_index_link(fmt("[%d]", i + 1), fmt("Page %d", i + 1),
|
||||
class, search, sort, ofs);
|
||||
}
|
||||
html("</div>");
|
||||
}
|
||||
@ -264,7 +264,7 @@ void cgit_print_repolist()
|
||||
sort_repolist("section");
|
||||
|
||||
html("<table summary='repository list' class='list nowrap'>");
|
||||
for (i=0; i<cgit_repolist.count; i++) {
|
||||
for (i = 0; i < cgit_repolist.count; i++) {
|
||||
ctx.repo = &cgit_repolist.repos[i];
|
||||
if (!(is_match(ctx.repo) && is_in_url(ctx.repo)))
|
||||
continue;
|
||||
|
18
ui-shared.c
18
ui-shared.c
@ -23,7 +23,7 @@ static char *http_date(time_t t)
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
struct tm *tm = gmtime(&t);
|
||||
return fmt("%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm->tm_wday],
|
||||
tm->tm_mday, month[tm->tm_mon], 1900+tm->tm_year,
|
||||
tm->tm_mday, month[tm->tm_mon], 1900 + tm->tm_year,
|
||||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ char *cgit_fileurl(const char *reponame, const char *pagename,
|
||||
char *cgit_pageurl(const char *reponame, const char *pagename,
|
||||
const char *query)
|
||||
{
|
||||
return cgit_fileurl(reponame,pagename,0,query);
|
||||
return cgit_fileurl(reponame, pagename, 0, query);
|
||||
}
|
||||
|
||||
const char *cgit_repobasename(const char *reponame)
|
||||
@ -102,18 +102,18 @@ const char *cgit_repobasename(const char *reponame)
|
||||
static char rvbuf[1024];
|
||||
int p;
|
||||
const char *rv;
|
||||
strncpy(rvbuf,reponame,sizeof(rvbuf));
|
||||
strncpy(rvbuf, reponame, sizeof(rvbuf));
|
||||
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)
|
||||
@ -499,7 +499,7 @@ void cgit_object_link(struct object *obj)
|
||||
shortrev = xstrdup(fullrev);
|
||||
shortrev[10] = '\0';
|
||||
if (obj->type == OBJ_COMMIT) {
|
||||
cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL,
|
||||
cgit_commit_link(fmt("commit %s...", shortrev), NULL, NULL,
|
||||
ctx.qry.head, fullrev, NULL, 0);
|
||||
return;
|
||||
} else if (obj->type == OBJ_TREE)
|
||||
@ -736,7 +736,7 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
|
||||
|
||||
if (prefixcmp(refname, "refs/archives"))
|
||||
return 0;
|
||||
strncpy(buf, refname+14, sizeof(buf));
|
||||
strncpy(buf, refname + 14, sizeof(buf));
|
||||
obj = parse_object(sha1);
|
||||
if (!obj)
|
||||
return 1;
|
||||
@ -968,7 +968,7 @@ void cgit_print_snapshot_links(const char *repo, const char *head,
|
||||
{
|
||||
const struct cgit_snapshot_format* f;
|
||||
char *prefix;
|
||||
char *filename;
|
||||
char *filename;
|
||||
unsigned char sha1[20];
|
||||
|
||||
if (get_sha1(fmt("refs/tags/%s", hex), sha1) == 0 &&
|
||||
|
@ -23,21 +23,21 @@ static void trunc_week(struct tm *tm)
|
||||
{
|
||||
time_t t = timegm(tm);
|
||||
t -= ((tm->tm_wday + 6) % 7) * DAY_SECS;
|
||||
gmtime_r(&t, tm);
|
||||
gmtime_r(&t, tm);
|
||||
}
|
||||
|
||||
static void dec_week(struct tm *tm)
|
||||
{
|
||||
time_t t = timegm(tm);
|
||||
t -= WEEK_SECS;
|
||||
gmtime_r(&t, tm);
|
||||
gmtime_r(&t, tm);
|
||||
}
|
||||
|
||||
static void inc_week(struct tm *tm)
|
||||
{
|
||||
time_t t = timegm(tm);
|
||||
t += WEEK_SECS;
|
||||
gmtime_r(&t, tm);
|
||||
gmtime_r(&t, tm);
|
||||
}
|
||||
|
||||
static char *pretty_week(struct tm *tm)
|
||||
@ -153,7 +153,7 @@ int cgit_find_stats_period(const char *expr, struct cgit_period **period)
|
||||
if (periods[i].code == code || !strcmp(periods[i].name, expr)) {
|
||||
if (period)
|
||||
*period = &periods[i];
|
||||
return i+1;
|
||||
return i + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
2
ui-tag.c
2
ui-tag.c
@ -99,6 +99,6 @@ void cgit_print_tag(char *revname)
|
||||
if (ctx.repo->snapshots)
|
||||
print_download_links(revname);
|
||||
html("</table>\n");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
|
||||
html("<tr><td class='linenumbers'><pre>");
|
||||
idx = 0;
|
||||
lineno = 0;
|
||||
|
||||
|
||||
if (size) {
|
||||
htmlf(numberfmt, ++lineno);
|
||||
while(idx < size - 1) { // skip absolute last newline
|
||||
@ -228,7 +228,7 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
|
||||
|
||||
if (state == 0) {
|
||||
memcpy(buffer, base, baselen);
|
||||
strcpy(buffer+baselen, pathname);
|
||||
strcpy(buffer + baselen, pathname);
|
||||
if (strcmp(match_path, buffer))
|
||||
return READ_TREE_RECURSIVE;
|
||||
|
||||
|
Laden…
Verwijs in nieuw issue
Block a user