author | Lars Hjemli <hjemli@gmail.com> | 2008-03-24 22:10:59 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-03-24 22:27:16 (UTC) |
commit | 92908af4558d7362c7deeb05254343a5a5f11a05 (patch) (unidiff) | |
tree | 6913a6f567375446fb680bc7e94dbabb5d8e496d /shared.c | |
parent | df90b51bafec24336cf30339b2978ff6df22b075 (diff) | |
download | cgit-92908af4558d7362c7deeb05254343a5a5f11a05.zip cgit-92908af4558d7362c7deeb05254343a5a5f11a05.tar.gz cgit-92908af4558d7362c7deeb05254343a5a5f11a05.tar.bz2 |
Move cgit_version from shared.c to cgit.c
With the matching Makefile change, this makes sure that only cgit.o and cgit
proper needs to be rebuildt when VERSION has been modified.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | shared.c | 2 |
1 files changed, 0 insertions, 2 deletions
@@ -1,64 +1,62 @@ | |||
1 | /* shared.c: global vars + some callback functions | 1 | /* shared.c: global vars + some callback functions |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | 10 | ||
11 | struct cgit_repolist cgit_repolist; | 11 | struct cgit_repolist cgit_repolist; |
12 | struct cgit_context ctx; | 12 | struct cgit_context ctx; |
13 | int cgit_cmd; | 13 | int cgit_cmd; |
14 | 14 | ||
15 | const char *cgit_version = CGIT_VERSION; | ||
16 | |||
17 | int chk_zero(int result, char *msg) | 15 | int chk_zero(int result, char *msg) |
18 | { | 16 | { |
19 | if (result != 0) | 17 | if (result != 0) |
20 | die("%s: %s", msg, strerror(errno)); | 18 | die("%s: %s", msg, strerror(errno)); |
21 | return result; | 19 | return result; |
22 | } | 20 | } |
23 | 21 | ||
24 | int chk_positive(int result, char *msg) | 22 | int chk_positive(int result, char *msg) |
25 | { | 23 | { |
26 | if (result <= 0) | 24 | if (result <= 0) |
27 | die("%s: %s", msg, strerror(errno)); | 25 | die("%s: %s", msg, strerror(errno)); |
28 | return result; | 26 | return result; |
29 | } | 27 | } |
30 | 28 | ||
31 | int chk_non_negative(int result, char *msg) | 29 | int chk_non_negative(int result, char *msg) |
32 | { | 30 | { |
33 | if (result < 0) | 31 | if (result < 0) |
34 | die("%s: %s",msg, strerror(errno)); | 32 | die("%s: %s",msg, strerror(errno)); |
35 | return result; | 33 | return result; |
36 | } | 34 | } |
37 | 35 | ||
38 | struct cgit_repo *cgit_add_repo(const char *url) | 36 | struct cgit_repo *cgit_add_repo(const char *url) |
39 | { | 37 | { |
40 | struct cgit_repo *ret; | 38 | struct cgit_repo *ret; |
41 | 39 | ||
42 | if (++cgit_repolist.count > cgit_repolist.length) { | 40 | if (++cgit_repolist.count > cgit_repolist.length) { |
43 | if (cgit_repolist.length == 0) | 41 | if (cgit_repolist.length == 0) |
44 | cgit_repolist.length = 8; | 42 | cgit_repolist.length = 8; |
45 | else | 43 | else |
46 | cgit_repolist.length *= 2; | 44 | cgit_repolist.length *= 2; |
47 | cgit_repolist.repos = xrealloc(cgit_repolist.repos, | 45 | cgit_repolist.repos = xrealloc(cgit_repolist.repos, |
48 | cgit_repolist.length * | 46 | cgit_repolist.length * |
49 | sizeof(struct cgit_repo)); | 47 | sizeof(struct cgit_repo)); |
50 | } | 48 | } |
51 | 49 | ||
52 | ret = &cgit_repolist.repos[cgit_repolist.count-1]; | 50 | ret = &cgit_repolist.repos[cgit_repolist.count-1]; |
53 | ret->url = trim_end(url, '/'); | 51 | ret->url = trim_end(url, '/'); |
54 | ret->name = ret->url; | 52 | ret->name = ret->url; |
55 | ret->path = NULL; | 53 | ret->path = NULL; |
56 | ret->desc = "[no description]"; | 54 | ret->desc = "[no description]"; |
57 | ret->owner = NULL; | 55 | ret->owner = NULL; |
58 | ret->group = ctx.cfg.repo_group; | 56 | ret->group = ctx.cfg.repo_group; |
59 | ret->defbranch = "master"; | 57 | ret->defbranch = "master"; |
60 | ret->snapshots = ctx.cfg.snapshots; | 58 | ret->snapshots = ctx.cfg.snapshots; |
61 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; | 59 | ret->enable_log_filecount = ctx.cfg.enable_log_filecount; |
62 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; | 60 | ret->enable_log_linecount = ctx.cfg.enable_log_linecount; |
63 | ret->module_link = ctx.cfg.module_link; | 61 | ret->module_link = ctx.cfg.module_link; |
64 | ret->readme = NULL; | 62 | ret->readme = NULL; |