|
diff --git a/cgit.h b/cgit.h index f01f6c9..6937c42 100644 --- a/ cgit.h+++ b/ cgit.h |
|
@@ -148,24 +148,25 @@ extern char *cgit_query_name; |
148 | extern int cgit_query_ofs; |
148 | extern int cgit_query_ofs; |
149 | |
149 | |
150 | extern int htmlfd; |
150 | extern int htmlfd; |
151 | |
151 | |
152 | extern int cgit_get_cmd_index(const char *cmd); |
152 | extern int cgit_get_cmd_index(const char *cmd); |
153 | extern struct repoinfo *cgit_get_repoinfo(const char *url); |
153 | extern struct repoinfo *cgit_get_repoinfo(const char *url); |
154 | extern void cgit_global_config_cb(const char *name, const char *value); |
154 | extern void cgit_global_config_cb(const char *name, const char *value); |
155 | extern void cgit_repo_config_cb(const char *name, const char *value); |
155 | extern void cgit_repo_config_cb(const char *name, const char *value); |
156 | extern void cgit_querystring_cb(const char *name, const char *value); |
156 | extern void cgit_querystring_cb(const char *name, const char *value); |
157 | |
157 | |
158 | extern int chk_zero(int result, char *msg); |
158 | extern int chk_zero(int result, char *msg); |
159 | extern int chk_positive(int result, char *msg); |
159 | extern int chk_positive(int result, char *msg); |
| |
160 | extern int chk_non_negative(int result, char *msg); |
160 | |
161 | |
161 | extern int hextoint(char c); |
162 | extern int hextoint(char c); |
162 | extern char *trim_end(const char *str, char c); |
163 | extern char *trim_end(const char *str, char c); |
163 | |
164 | |
164 | extern void *cgit_free_commitinfo(struct commitinfo *info); |
165 | extern void *cgit_free_commitinfo(struct commitinfo *info); |
165 | |
166 | |
166 | extern int cgit_diff_files(const unsigned char *old_sha1, |
167 | extern int cgit_diff_files(const unsigned char *old_sha1, |
167 | const unsigned char *new_sha1, |
168 | const unsigned char *new_sha1, |
168 | linediff_fn fn); |
169 | linediff_fn fn); |
169 | |
170 | |
170 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
171 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
171 | const unsigned char *new_sha1, |
172 | const unsigned char *new_sha1, |
|
|
diff --git a/shared.c b/shared.c index 1a5b866..65fc8b2 100644 --- a/ shared.c+++ b/ shared.c |
|
@@ -77,24 +77,31 @@ int chk_zero(int result, char *msg) |
77 | if (result != 0) |
77 | if (result != 0) |
78 | die("%s: %s", msg, strerror(errno)); |
78 | die("%s: %s", msg, strerror(errno)); |
79 | return result; |
79 | return result; |
80 | } |
80 | } |
81 | |
81 | |
82 | int chk_positive(int result, char *msg) |
82 | int chk_positive(int result, char *msg) |
83 | { |
83 | { |
84 | if (result <= 0) |
84 | if (result <= 0) |
85 | die("%s: %s", msg, strerror(errno)); |
85 | die("%s: %s", msg, strerror(errno)); |
86 | return result; |
86 | return result; |
87 | } |
87 | } |
88 | |
88 | |
| |
89 | int chk_non_negative(int result, char *msg) |
| |
90 | { |
| |
91 | if (result < 0) |
| |
92 | die("%s: %s",msg, strerror(errno)); |
| |
93 | return result; |
| |
94 | } |
| |
95 | |
89 | struct repoinfo *add_repo(const char *url) |
96 | struct repoinfo *add_repo(const char *url) |
90 | { |
97 | { |
91 | struct repoinfo *ret; |
98 | struct repoinfo *ret; |
92 | |
99 | |
93 | if (++cgit_repolist.count > cgit_repolist.length) { |
100 | if (++cgit_repolist.count > cgit_repolist.length) { |
94 | if (cgit_repolist.length == 0) |
101 | if (cgit_repolist.length == 0) |
95 | cgit_repolist.length = 8; |
102 | cgit_repolist.length = 8; |
96 | else |
103 | else |
97 | cgit_repolist.length *= 2; |
104 | cgit_repolist.length *= 2; |
98 | cgit_repolist.repos = xrealloc(cgit_repolist.repos, |
105 | cgit_repolist.repos = xrealloc(cgit_repolist.repos, |
99 | cgit_repolist.length * |
106 | cgit_repolist.length * |
100 | sizeof(struct repoinfo)); |
107 | sizeof(struct repoinfo)); |
|