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>
Jeff King committed
Apr 26, 2017 at 23:28 UTC
721f5f1e355648f6b15d79799a3fdc6b4a28352f
1 file changed
+9
-11
builtin/am.c
+9
-11
@@ -1378,33 +1378,31 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
1378
{
1379
const char *buffer, *ident_line, *msg;
1380
size_t ident_len;
1381
- struct ident_split ident_split;
1381
+ struct ident_split id;
1382
1383
buffer = logmsg_reencode(commit, NULL, get_commit_output_encoding());
1384
1385
ident_line = find_commit_header(buffer, "author", &ident_len);
1386
1387
- if (split_ident_line(&ident_split, ident_line, ident_len) < 0)
1387
+ if (split_ident_line(&id, ident_line, ident_len) < 0)
1388
die(_("invalid ident line: %.*s"), (int)ident_len, ident_line);
1389
1390
assert(!state->author_name);
1391
- if (ident_split.name_begin) {
1391
+ if (id.name_begin)
1392
state->author_name =
1393
- xmemdupz(ident_split.name_begin,
1394
- ident_split.name_end - ident_split.name_begin);
1395
- } else
1393
+ xmemdupz(id.name_begin, id.name_end - id.name_begin);
1394
+ else
1395
state->author_name = xstrdup("");
1396
1397
assert(!state->author_email);
1399
- if (ident_split.mail_begin) {
1398
+ if (id.mail_begin)
1399
state->author_email =
1401
- xmemdupz(ident_split.mail_begin,
1402
- ident_split.mail_end - ident_split.mail_begin);
1403
- } else
1400
+ xmemdupz(id.mail_begin, id.mail_end - id.mail_begin);
1401
+ else
1402
state->author_email = xstrdup("");
1403
1404
assert(!state->author_date);
1407
- state->author_date = xstrdup(show_ident_date(&ident_split, DATE_MODE(NORMAL)));
1405
+ state->author_date = xstrdup(show_ident_date(&id, DATE_MODE(NORMAL)));
1406
1407
assert(!state->msg);
1408
msg = strstr(buffer, "\n\n");