Skip to content

Commit

Permalink
revert: rename variables related to subject in get_message()
Browse files Browse the repository at this point in the history
Generic-looking pointer variable "p" was used only to point at subject
string and had a rather lifespan.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Christian Couder authored and Junio C Hamano committed Jul 23, 2010
1 parent 11af2aa commit dfe7eff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions builtin/revert.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ struct commit_message {
static int get_message(const char *raw_message, struct commit_message *out)
{
const char *encoding;
const char *p, *abbrev;
const char *abbrev, *subject;
int abbrev_len, subject_len;
char *q;
int abbrev_len, oneline_len;

if (!raw_message)
return -1;
Expand All @@ -121,17 +121,17 @@ static int get_message(const char *raw_message, struct commit_message *out)
abbrev = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);
abbrev_len = strlen(abbrev);

oneline_len = find_commit_subject(out->message, &p);
subject_len = find_commit_subject(out->message, &subject);

out->parent_label = xmalloc(strlen("parent of ") + abbrev_len +
strlen("... ") + oneline_len + 1);
strlen("... ") + subject_len + 1);
q = out->parent_label;
q = mempcpy(q, "parent of ", strlen("parent of "));
out->label = q;
q = mempcpy(q, abbrev, abbrev_len);
q = mempcpy(q, "... ", strlen("... "));
out->subject = q;
q = mempcpy(q, p, oneline_len);
q = mempcpy(q, subject, subject_len);
*q = '\0';
return 0;
}
Expand Down

0 comments on commit dfe7eff

Please sign in to comment.