author | Martins Polakovs <martins.polakovs@gmail.com> | 2009-12-10 15:35:42 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-12-12 10:56:25 (UTC) |
commit | 24538b072718924d3418a258cf0009fb5b5768de (patch) (unidiff) | |
tree | 54a2ea6fb82c5ff99f188624a24b7c5d54657095 /ui-tree.c | |
parent | f2bf0a05280edddb4961214adfd7b440191737e2 (diff) | |
download | cgit-24538b072718924d3418a258cf0009fb5b5768de.zip cgit-24538b072718924d3418a258cf0009fb5b5768de.tar.gz cgit-24538b072718924d3418a258cf0009fb5b5768de.tar.bz2 |
Fix segfault on ppc when browsing tree
-rw-r--r-- | ui-tree.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -251,35 +251,35 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen, | |||
251 | * path: path to tree or blob | 251 | * path: path to tree or blob |
252 | */ | 252 | */ |
253 | void cgit_print_tree(const char *rev, char *path) | 253 | void cgit_print_tree(const char *rev, char *path) |
254 | { | 254 | { |
255 | unsigned char sha1[20]; | 255 | unsigned char sha1[20]; |
256 | struct commit *commit; | 256 | struct commit *commit; |
257 | const char *paths[] = {path, NULL}; | 257 | const char *paths[] = {path, NULL}; |
258 | 258 | ||
259 | if (!rev) | 259 | if (!rev) |
260 | rev = ctx.qry.head; | 260 | rev = ctx.qry.head; |
261 | 261 | ||
262 | curr_rev = xstrdup(rev); | 262 | curr_rev = xstrdup(rev); |
263 | if (get_sha1(rev, sha1)) { | 263 | if (get_sha1(rev, sha1)) { |
264 | cgit_print_error(fmt("Invalid revision name: %s", rev)); | 264 | cgit_print_error(fmt("Invalid revision name: %s", rev)); |
265 | return; | 265 | return; |
266 | } | 266 | } |
267 | commit = lookup_commit_reference(sha1); | 267 | commit = lookup_commit_reference(sha1); |
268 | if (!commit || parse_commit(commit)) { | 268 | if (!commit || parse_commit(commit)) { |
269 | cgit_print_error(fmt("Invalid commit reference: %s", rev)); | 269 | cgit_print_error(fmt("Invalid commit reference: %s", rev)); |
270 | return; | 270 | return; |
271 | } | 271 | } |
272 | 272 | ||
273 | html("path: <a href='"); | 273 | html("path: <a href='"); |
274 | html_attr(cgit_pageurl(ctx.qry.repo, "tree", fmt("h=%s", rev))); | 274 | html_attr(cgit_pageurl(ctx.qry.repo, "tree", fmt("h=%s", rev))); |
275 | html("'>root</a>"); | 275 | html("'>root</a>"); |
276 | 276 | ||
277 | if (path == NULL) { | 277 | if (path == NULL) { |
278 | ls_tree(commit->tree->object.sha1, NULL); | 278 | ls_tree(commit->tree->object.sha1, NULL); |
279 | return; | 279 | return; |
280 | } | 280 | } |
281 | 281 | ||
282 | match_path = path; | 282 | match_path = path; |
283 | read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree, NULL); | 283 | read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL); |
284 | ls_tail(); | 284 | ls_tail(); |
285 | } | 285 | } |