Skip to content

Commit 8e76bf3

Browse files
d0kgitster
authored andcommitted
Remove unused assignments
These variables were always overwritten or the assigned value was unused: builtin-diff-tree.c::cmd_diff_tree(): nr_sha1 builtin-for-each-ref.c::opt_parse_sort(): sort_tail builtin-mailinfo.c::decode_header_bq(): in builtin-shortlog.c::insert_one_record(): len connect.c::git_connect(): path imap-send.c::v_issue_imap_cmd(): n pretty.c::pp_user_info(): filler remote::parse_refspec_internal(): llen Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7f733de commit 8e76bf3

File tree

8 files changed

+4
-10
lines changed

8 files changed

+4
-10
lines changed

builtin-diff-tree.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
102102

103103
init_revisions(opt, prefix);
104104
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
105-
nr_sha1 = 0;
106105
opt->abbrev = 0;
107106
opt->diff = 1;
108107
argc = setup_revisions(argc, argv, opt, NULL);

builtin-for-each-ref.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,6 @@ static int opt_parse_sort(const struct option *opt, const char *arg, int unset)
943943
return -1;
944944

945945
*sort_tail = s = xcalloc(1, sizeof(*s));
946-
sort_tail = &s->next;
947946

948947
if (*arg == '-') {
949948
s->reverse = 1;

builtin-mailinfo.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,6 @@ static int decode_header_bq(struct strbuf *it)
537537
*/
538538
strbuf_add(&outbuf, in, ep - in);
539539
}
540-
in = ep;
541540
}
542541
/* E.g.
543542
* ep : "=?iso-2022-jp?B?GyR...?= foo"

builtin-shortlog.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ static void insert_one_record(struct shortlog *log,
101101
}
102102
while (*oneline && isspace(*oneline) && *oneline != '\n')
103103
oneline++;
104-
len = eol - oneline;
105104
format_subject(&subject, oneline, " ");
106105
buffer = strbuf_detach(&subject, NULL);
107106

connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
504504
const char *prog, int flags)
505505
{
506506
char *url = xstrdup(url_orig);
507-
char *host, *path = url;
507+
char *host, *path;
508508
char *end;
509509
int c;
510510
struct child_process *conn;

imap-send.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ static struct imap_cmd *v_issue_imap_cmd(struct imap_store *ctx,
579579
n = socket_write(&imap->buf.sock, cmd->cb.data, cmd->cb.dlen);
580580
free(cmd->cb.data);
581581
if (n != cmd->cb.dlen ||
582-
(n = socket_write(&imap->buf.sock, "\r\n", 2)) != 2) {
582+
socket_write(&imap->buf.sock, "\r\n", 2) != 2) {
583583
free(cmd->cmd);
584584
free(cmd);
585585
return NULL;

pretty.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,
135135
int namelen;
136136
unsigned long time;
137137
int tz;
138-
const char *filler = " ";
139138

140139
if (fmt == CMIT_FMT_ONELINE)
141140
return;
@@ -154,15 +153,14 @@ void pp_user_info(const char *what, enum cmit_fmt fmt, struct strbuf *sb,
154153
while (line < name_tail && isspace(name_tail[-1]))
155154
name_tail--;
156155
display_name_length = name_tail - line;
157-
filler = "";
158156
strbuf_addstr(sb, "From: ");
159157
add_rfc2047(sb, line, display_name_length, encoding);
160158
strbuf_add(sb, name_tail, namelen - display_name_length);
161159
strbuf_addch(sb, '\n');
162160
} else {
163161
strbuf_addf(sb, "%s: %.*s%.*s\n", what,
164162
(fmt == CMIT_FMT_FULLER) ? 4 : 0,
165-
filler, namelen, line);
163+
" ", namelen, line);
166164
}
167165
switch (fmt) {
168166
case CMIT_FMT_MEDIUM:

remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ static struct refspec *parse_refspec_internal(int nr_refspec, const char **refsp
495495
int is_glob;
496496
const char *lhs, *rhs;
497497

498-
llen = is_glob = 0;
498+
is_glob = 0;
499499

500500
lhs = refspec[i];
501501
if (*lhs == '+') {

0 commit comments

Comments
 (0)