about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Fleischer <cgit@cryptocrack.de>2013-08-20 18:56:15 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2013-08-20 19:55:54 +0200
commit4e00d338b07245829adf2446a05fe4925b691092 (patch)
tree2f0a96954a7eeae502cc9d697d335866fc22e6d5
parentAllow for creating patch series (diff)
downloadcgit-pink-4e00d338b07245829adf2446a05fe4925b691092.tar.gz
cgit-pink-4e00d338b07245829adf2446a05fe4925b691092.zip
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 <cgit@cryptocrack.de>
-rw-r--r--ui-patch.c33
-rw-r--r--ui-patch.h3
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 */
lass='logheader'>2020-02-11Add startup GPLv3 note and URLJune McEnroe I am a degenerate. 2020-02-11Make sure -D_GNU_SOURCE ends up in CFLAGS on LinuxJune McEnroe 2020-02-11Add note about setting PKG_CONFIG_PATHJune McEnroe 2020-02-11Rename query ID on nick changeJune McEnroe 2020-02-11Call completeClear when closing a windowJune McEnroe 2020-02-11Don't insert color codes for non-mentionsJune McEnroe 2020-02-11Take first two words in colorMentionsJune McEnroe This lets phrases like "hi june" get colored, but still doesn't get carried away. 2020-02-11Use time_t for save signatureJune McEnroe It's actually more likely to be 64-bit than size_t anyway, and it eliminates some helper functions. Also don't error when reading an empty save file. 2020-02-11Set self.nick to * initiallyJune McEnroe Allows removing a bunch of checks that self.nick is set, and it's what the server usually calls you before registration. Never highlight notices as mentions. 2020-02-11Define ColorCap instead of hardcoding 100June McEnroe 2020-02-11Move hash to top of chat.hJune McEnroe 2020-02-11Move base64 out of chat.hJune McEnroe 2020-02-11Move XDG_SUBDIR out of chat.hJune McEnroe 2020-02-11Fix whois idle unit calculationJune McEnroe Rookie mistake. 2020-02-11Cast towupper to wchar_tJune McEnroe For some reason it takes and returns wint_t... 2020-02-11Cast set but unused variables to voidJune McEnroe 2020-02-11Declare strlcatJune McEnroe 2020-02-11Check if VDSUSP existsJune McEnroe 2020-02-11Fix completeReplace iterationJune McEnroe 2020-02-11Use pkg(8) to configure on FreeBSDJune McEnroe 2020-02-11Remove legacy codeJune McEnroe 2020-02-11Add INSTALLING section to READMEJune McEnroe