summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2017-04-26 23:28:31 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-04-27 14:40:18 +0900
commit721f5f1e355648f6b15d79799a3fdc6b4a28352f (patch)
treed63095adaa86393d430e53ecd79470173c475b26 /builtin
parentam: simplify allocations in get_commit_info() (diff)
downloadtgif-721f5f1e355648f6b15d79799a3fdc6b4a28352f.tar.xz
am: shorten ident_split variable name in get_commit_info()
The local ident_split variable is often mentioned three times per line when dealing with its begin/end pointer pairs. Let's use a shorter name which lets us get rid of some long lines. Since this is a short self-contained function, readability doesn't suffer. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/am.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 17f394c825..5c747faa05 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1378,33 +1378,31 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
{
const char *buffer, *ident_line, *msg;
size_t ident_len;
- struct ident_split ident_split;
+ struct ident_split id;
buffer = logmsg_reencode(commit, NULL, get_commit_output_encoding());
ident_line = find_commit_header(buffer, "author", &ident_len);
- if (split_ident_line(&ident_split, ident_line, ident_len) < 0)
+ if (split_ident_line(&id, ident_line, ident_len) < 0)
die(_("invalid ident line: %.*s"), (int)ident_len, ident_line);
assert(!state->author_name);
- if (ident_split.name_begin) {
+ if (id.name_begin)
state->author_name =
- xmemdupz(ident_split.name_begin,
- ident_split.name_end - ident_split.name_begin);
- } else
+ xmemdupz(id.name_begin, id.name_end - id.name_begin);
+ else
state->author_name = xstrdup("");
assert(!state->author_email);
- if (ident_split.mail_begin) {
+ if (id.mail_begin)
state->author_email =
- xmemdupz(ident_split.mail_begin,
- ident_split.mail_end - ident_split.mail_begin);
- } else
+ xmemdupz(id.mail_begin, id.mail_end - id.mail_begin);
+ else
state->author_email = xstrdup("");
assert(!state->author_date);
- state->author_date = xstrdup(show_ident_date(&ident_split, DATE_MODE(NORMAL)));
+ state->author_date = xstrdup(show_ident_date(&id, DATE_MODE(NORMAL)));
assert(!state->msg);
msg = strstr(buffer, "\n\n");