Skip to content

Commit 721f5f1

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2e2bbb9 commit 721f5f1

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

builtin/am.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,33 +1378,31 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
13781378
{
13791379
const char *buffer, *ident_line, *msg;
13801380
size_t ident_len;
1381-
struct ident_split ident_split;
1381+
struct ident_split id;
13821382

13831383
buffer = logmsg_reencode(commit, NULL, get_commit_output_encoding());
13841384

13851385
ident_line = find_commit_header(buffer, "author", &ident_len);
13861386

1387-
if (split_ident_line(&ident_split, ident_line, ident_len) < 0)
1387+
if (split_ident_line(&id, ident_line, ident_len) < 0)
13881388
die(_("invalid ident line: %.*s"), (int)ident_len, ident_line);
13891389

13901390
assert(!state->author_name);
1391-
if (ident_split.name_begin) {
1391+
if (id.name_begin)
13921392
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
13961395
state->author_name = xstrdup("");
13971396

13981397
assert(!state->author_email);
1399-
if (ident_split.mail_begin) {
1398+
if (id.mail_begin)
14001399
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
14041402
state->author_email = xstrdup("");
14051403

14061404
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)));
14081406

14091407
assert(!state->msg);
14101408
msg = strstr(buffer, "\n\n");

0 commit comments

Comments
 (0)