зеркало из https://github.com/microsoft/git.git
Move local variables to narrower scopes
These weren't used outside and can be safely moved Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
eb3a9dd327
Коммит
fd13b21f52
|
@ -256,8 +256,7 @@ static void shortlog(const char *name, unsigned char *sha1,
|
|||
|
||||
int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {
|
||||
int limit = 20, i = 0, pos = 0;
|
||||
char line[1024];
|
||||
char *p = line, *sep = "";
|
||||
char *sep = "";
|
||||
unsigned char head_sha1[20];
|
||||
const char *current_branch;
|
||||
|
||||
|
@ -271,9 +270,8 @@ int fmt_merge_msg(int merge_summary, struct strbuf *in, struct strbuf *out) {
|
|||
/* get a line */
|
||||
while (pos < in->len) {
|
||||
int len;
|
||||
char *newline;
|
||||
char *newline, *p = in->buf + pos;
|
||||
|
||||
p = in->buf + pos;
|
||||
newline = strchr(p, '\n');
|
||||
len = newline ? newline - p : strlen(p);
|
||||
pos += len + !!newline;
|
||||
|
|
|
@ -526,7 +526,6 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
|
|||
return; /* result deleted */
|
||||
|
||||
while (1) {
|
||||
struct sline *sl = &sline[lno];
|
||||
unsigned long hunk_end;
|
||||
unsigned long rlines;
|
||||
const char *hunk_comment = NULL;
|
||||
|
@ -592,7 +591,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
|
|||
struct lline *ll;
|
||||
int j;
|
||||
unsigned long p_mask;
|
||||
sl = &sline[lno++];
|
||||
struct sline *sl = &sline[lno++];
|
||||
ll = (sl->flag & no_pre_delete) ? NULL : sl->lost_head;
|
||||
while (ll) {
|
||||
fputs(c_old, stdout);
|
||||
|
|
|
@ -79,18 +79,18 @@ void show_decorations(struct rev_info *opt, struct commit *commit)
|
|||
*/
|
||||
static int detect_any_signoff(char *letter, int size)
|
||||
{
|
||||
char ch, *cp;
|
||||
char *cp;
|
||||
int seen_colon = 0;
|
||||
int seen_at = 0;
|
||||
int seen_name = 0;
|
||||
int seen_head = 0;
|
||||
|
||||
cp = letter + size;
|
||||
while (letter <= --cp && (ch = *cp) == '\n')
|
||||
while (letter <= --cp && *cp == '\n')
|
||||
continue;
|
||||
|
||||
while (letter <= cp) {
|
||||
ch = *cp--;
|
||||
char ch = *cp--;
|
||||
if (ch == '\n')
|
||||
break;
|
||||
|
||||
|
|
|
@ -397,12 +397,11 @@ static int get_common_commits(void)
|
|||
static char line[1000];
|
||||
unsigned char sha1[20];
|
||||
char hex[41], last_hex[41];
|
||||
int len;
|
||||
|
||||
save_commit_buffer = 0;
|
||||
|
||||
for(;;) {
|
||||
len = packet_read_line(0, line, sizeof(line));
|
||||
int len = packet_read_line(0, line, sizeof(line));
|
||||
reset_timeout();
|
||||
|
||||
if (!len) {
|
||||
|
@ -410,7 +409,7 @@ static int get_common_commits(void)
|
|||
packet_write(1, "NAK\n");
|
||||
continue;
|
||||
}
|
||||
len = strip(line, len);
|
||||
strip(line, len);
|
||||
if (!prefixcmp(line, "have ")) {
|
||||
switch (got_sha1(line+5, sha1)) {
|
||||
case -1: /* they have what we do not */
|
||||
|
|
Загрузка…
Ссылка в новой задаче