diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-03-21 04:21:25 (JST) |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2013-03-21 04:21:25 (JST) |
commit | 0255821e22678d4c58c809efe17bf2798835d5b9 (patch) | |
tree | d4679ff23796406648cf83ff0b98940ba844c5e1 /cgit.c | |
parent | 6d8a789d61f3a682bc040f1f7f44050b1f723546 (diff) | |
parent | 59fe348deaa270434f05afc56ca8d13618af9ca9 (diff) | |
download | cgit-0255821e22678d4c58c809efe17bf2798835d5b9.zip cgit-0255821e22678d4c58c809efe17bf2798835d5b9.tar.gz |
Merge branch 'wip'
Diffstat (limited to 'cgit.c')
-rw-r--r-- | cgit.c | 34 |
1 files changed, 21 insertions, 13 deletions
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | const char *cgit_version = CGIT_VERSION; | 19 | const char *cgit_version = CGIT_VERSION; |
20 | 20 | ||
21 | void add_mimetype(const char *name, const char *value) | 21 | static void add_mimetype(const char *name, const char *value) |
22 | { | 22 | { |
23 | struct string_list_item *item; | 23 | struct string_list_item *item; |
24 | 24 | ||
@@ -26,7 +26,7 @@ void add_mimetype(const char *name, const char *value) | |||
26 | item->util = xstrdup(value); | 26 | item->util = xstrdup(value); |
27 | } | 27 | } |
28 | 28 | ||
29 | struct cgit_filter *new_filter(const char *cmd, filter_type filtertype) | 29 | static struct cgit_filter *new_filter(const char *cmd, filter_type filtertype) |
30 | { | 30 | { |
31 | struct cgit_filter *f; | 31 | struct cgit_filter *f; |
32 | int args_size = 0; | 32 | int args_size = 0; |
@@ -58,7 +58,7 @@ struct cgit_filter *new_filter(const char *cmd, filter_type filtertype) | |||
58 | 58 | ||
59 | static void process_cached_repolist(const char *path); | 59 | static void process_cached_repolist(const char *path); |
60 | 60 | ||
61 | void repo_config(struct cgit_repo *repo, const char *name, const char *value) | 61 | static void repo_config(struct cgit_repo *repo, const char *name, const char *value) |
62 | { | 62 | { |
63 | struct string_list_item *item; | 63 | struct string_list_item *item; |
64 | 64 | ||
@@ -114,7 +114,7 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value) | |||
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | void config_cb(const char *name, const char *value) | 117 | static void config_cb(const char *name, const char *value) |
118 | { | 118 | { |
119 | if (!strcmp(name, "section") || !strcmp(name, "repo.group")) | 119 | if (!strcmp(name, "section") || !strcmp(name, "repo.group")) |
120 | ctx.cfg.section = xstrdup(value); | 120 | ctx.cfg.section = xstrdup(value); |
@@ -333,7 +333,7 @@ static void querystring_cb(const char *name, const char *value) | |||
333 | } | 333 | } |
334 | } | 334 | } |
335 | 335 | ||
336 | char *xstrdupn(const char *str) | 336 | static char *xstrdupn(const char *str) |
337 | { | 337 | { |
338 | return (str ? xstrdup(str) : NULL); | 338 | return (str ? xstrdup(str) : NULL); |
339 | } | 339 | } |
@@ -414,8 +414,8 @@ struct refmatch { | |||
414 | int match; | 414 | int match; |
415 | }; | 415 | }; |
416 | 416 | ||
417 | int find_current_ref(const char *refname, const unsigned char *sha1, | 417 | static int find_current_ref(const char *refname, const unsigned char *sha1, |
418 | int flags, void *cb_data) | 418 | int flags, void *cb_data) |
419 | { | 419 | { |
420 | struct refmatch *info; | 420 | struct refmatch *info; |
421 | 421 | ||
@@ -427,7 +427,13 @@ int find_current_ref(const char *refname, const unsigned char *sha1, | |||
427 | return info->match; | 427 | return info->match; |
428 | } | 428 | } |
429 | 429 | ||
430 | char *find_default_branch(struct cgit_repo *repo) | 430 | static void free_refmatch_inner(struct refmatch *info) |
431 | { | ||
432 | if (info->first_ref) | ||
433 | free(info->first_ref); | ||
434 | } | ||
435 | |||
436 | static char *find_default_branch(struct cgit_repo *repo) | ||
431 | { | 437 | { |
432 | struct refmatch info; | 438 | struct refmatch info; |
433 | char *ref; | 439 | char *ref; |
@@ -442,6 +448,8 @@ char *find_default_branch(struct cgit_repo *repo) | |||
442 | ref = info.first_ref; | 448 | ref = info.first_ref; |
443 | if (ref) | 449 | if (ref) |
444 | ref = xstrdup(ref); | 450 | ref = xstrdup(ref); |
451 | free_refmatch_inner(&info); | ||
452 | |||
445 | return ref; | 453 | return ref; |
446 | } | 454 | } |
447 | 455 | ||
@@ -569,13 +577,13 @@ static void process_request(void *cbdata) | |||
569 | cgit_print_docend(); | 577 | cgit_print_docend(); |
570 | } | 578 | } |
571 | 579 | ||
572 | int cmp_repos(const void *a, const void *b) | 580 | static int cmp_repos(const void *a, const void *b) |
573 | { | 581 | { |
574 | const struct cgit_repo *ra = a, *rb = b; | 582 | const struct cgit_repo *ra = a, *rb = b; |
575 | return strcmp(ra->url, rb->url); | 583 | return strcmp(ra->url, rb->url); |
576 | } | 584 | } |
577 | 585 | ||
578 | char *build_snapshot_setting(int bitmap) | 586 | static char *build_snapshot_setting(int bitmap) |
579 | { | 587 | { |
580 | const struct cgit_snapshot_format *f; | 588 | const struct cgit_snapshot_format *f; |
581 | char *result = xstrdup(""); | 589 | char *result = xstrdup(""); |
@@ -595,7 +603,7 @@ char *build_snapshot_setting(int bitmap) | |||
595 | return result; | 603 | return result; |
596 | } | 604 | } |
597 | 605 | ||
598 | char *get_first_line(char *txt) | 606 | static char *get_first_line(char *txt) |
599 | { | 607 | { |
600 | char *t = xstrdup(txt); | 608 | char *t = xstrdup(txt); |
601 | char *p = strchr(t, '\n'); | 609 | char *p = strchr(t, '\n'); |
@@ -604,7 +612,7 @@ char *get_first_line(char *txt) | |||
604 | return t; | 612 | return t; |
605 | } | 613 | } |
606 | 614 | ||
607 | void print_repo(FILE *f, struct cgit_repo *repo) | 615 | static void print_repo(FILE *f, struct cgit_repo *repo) |
608 | { | 616 | { |
609 | fprintf(f, "repo.url=%s\n", repo->url); | 617 | fprintf(f, "repo.url=%s\n", repo->url); |
610 | fprintf(f, "repo.name=%s\n", repo->name); | 618 | fprintf(f, "repo.name=%s\n", repo->name); |
@@ -649,7 +657,7 @@ void print_repo(FILE *f, struct cgit_repo *repo) | |||
649 | fprintf(f, "\n"); | 657 | fprintf(f, "\n"); |
650 | } | 658 | } |
651 | 659 | ||
652 | void print_repolist(FILE *f, struct cgit_repolist *list, int start) | 660 | static void print_repolist(FILE *f, struct cgit_repolist *list, int start) |
653 | { | 661 | { |
654 | int i; | 662 | int i; |
655 | 663 | ||