From 4e00d338b07245829adf2446a05fe4925b691092 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 20 Aug 2013 18:56:15 +0200 Subject: ui-patch: Rename variables Rename parameters and local variables to match those from ui-diff. Also, convert a "char *" to "const char *". Signed-off-by: Lukas Fleischer --- ui-patch.c | 33 +++++++++++++++++---------------- ui-patch.h | 3 ++- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/ui-patch.c b/ui-patch.c index bb39294..1dbb39d 100644 --- a/ui-patch.c +++ b/ui-patch.c @@ -11,48 +11,49 @@ #include "html.h" #include "ui-shared.h" -void cgit_print_patch(char *hex, const char *old_rev, const char *prefix) +void cgit_print_patch(const char *new_rev, const char *old_rev, + const char *prefix) { struct rev_info rev; struct commit *commit; - unsigned char sha1[20], old_sha1[20]; + unsigned char new_rev_sha1[20], old_rev_sha1[20]; char rev_range[2 * 40 + 3]; char *rev_argv[] = { NULL, "--reverse", "--format=email", rev_range }; char *patchname; - if (!hex) - hex = ctx.qry.head; + if (!new_rev) + new_rev = ctx.qry.head; - if (get_sha1(hex, sha1)) { - cgit_print_error("Bad object id: %s", hex); + if (get_sha1(new_rev, new_rev_sha1)) { + cgit_print_error("Bad object id: %s", new_rev); return; } - commit = lookup_commit_reference(sha1); + commit = lookup_commit_reference(new_rev_sha1); if (!commit) { - cgit_print_error("Bad commit reference: %s", hex); + cgit_print_error("Bad commit reference: %s", new_rev); return; } if (old_rev) { - if (get_sha1(old_rev, old_sha1)) { + if (get_sha1(old_rev, old_rev_sha1)) { cgit_print_error("Bad object id: %s", old_rev); return; } - if (!lookup_commit_reference(old_sha1)) { + if (!lookup_commit_reference(old_rev_sha1)) { cgit_print_error("Bad commit reference: %s", old_rev); return; } } else if (commit->parents && commit->parents->item) { - hashcpy(old_sha1, commit->parents->item->object.sha1); + hashcpy(old_rev_sha1, commit->parents->item->object.sha1); } else { - hashclr(old_sha1); + hashclr(old_rev_sha1); } - if (is_null_sha1(old_sha1)) { - memcpy(rev_range, sha1_to_hex(sha1), 41); + if (is_null_sha1(old_rev_sha1)) { + memcpy(rev_range, sha1_to_hex(new_rev_sha1), 41); } else { - sprintf(rev_range, "%s..%s", sha1_to_hex(old_sha1), - sha1_to_hex(sha1)); + sprintf(rev_range, "%s..%s", sha1_to_hex(old_rev_sha1), + sha1_to_hex(new_rev_sha1)); } patchname = fmt("%s.patch", rev_range); diff --git a/ui-patch.h b/ui-patch.h index acd37fd..7a6cacd 100644 --- a/ui-patch.h +++ b/ui-patch.h @@ -1,6 +1,7 @@ #ifndef UI_PATCH_H #define UI_PATCH_H -extern void cgit_print_patch(char *hex, const char *old_rev, const char *prefix); +extern void cgit_print_patch(const char *new_rev, const char *old_rev, + const char *prefix); #endif /* UI_PATCH_H */ -- cgit 1.4.1 4098a7d08dbd5fede&follow=1'>Add link to gopher version of text.causal.agencyJune McEnroe 2021-01-14Add igp gopher server for text.causal.agencyJune McEnroe 2021-01-13Clean up html.shJune McEnroe 2021-01-13Remove ttpreJune McEnroe 2021-01-13Remove hiJune McEnroe 2021-01-13Add gg mapping to viJune McEnroe 2021-01-13Match \ before newline in string as EscapeJune McEnroe 2021-01-13Remove -t flag from ctags commandsJune McEnroe 2021-01-13Match strftime format specifiersJune McEnroe 2021-01-13Switch git.causal.agency to hilex and htagmlJune McEnroe 2021-01-13Try to return make substitutions as single tokensJune McEnroe 2021-01-13Shorten hilex class namesJune McEnroe 2021-01-13Move text "lexer" to hilex.cJune McEnroe 2021-01-13Try to return strings as single tokensJune McEnroe 2021-01-13Match [] as Operator in C lexerJune McEnroe 2021-01-13Fix C lexer to require a digit in a float literalJune McEnroe 2021-01-13Support long double in c.shJune McEnroe 2021-01-13Update Terminal.app coloursJune McEnroe 2021-01-13Increase dark white brightness slightlyJune McEnroe 2021-01-13Add hilex example to htagml manualJune McEnroe 2021-01-12Style causal.agency like bin HTMLJune McEnroe 2021-01-12Avoid matching tag text inside HTML elementsJune McEnroe 2021-01-12Use hilex for up -hJune McEnroe 2021-01-12Use hilex for bin HTMLJune McEnroe 2021-01-12Don't output a pre in hilex by defaultJune McEnroe 2021-01-12Move hilex out of hilex directoryJune McEnroe 2021-01-12Consolidate hilex formatters into hilex.cJune McEnroe 2021-01-12Remove hacky tagging from hilexJune McEnroe 2021-01-12Add htagml -iJune McEnroe 2021-01-12Render tag index in HTMLJune McEnroe 2021-01-12Add htagml -xJune McEnroe 2021-01-12Prevent matching the same tag twiceJune McEnroe 2021-01-12Process htagml file line by lineJune McEnroe 2021-01-12Split fields by tab onlyJune McEnroe 2021-01-12List both Makefile and html.sh under README.7June McEnroe 2021-01-12Add htagml exampleJune McEnroe 2021-01-12Use mandoc and htagml for bin htmlJune McEnroe 2021-01-12Add htagmlJune McEnroe 2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe 2021-01-11Publish "Using vi"June McEnroe 2021-01-11Enable diff.colorMovedJune McEnroe 2021-01-10Set less search case-insensitiveJune McEnroe 2021-01-10Set EXINITJune McEnroe 2021-01-09Add c -t flag to print expression typeJune McEnroe 2021-01-05Update taglineJune McEnroe