Skip to content

Commit eb3a9dd

Browse files
d0kgitster
authored andcommitted
Remove unused function scope local variables
These variables were unused and can be removed safely: builtin-clone.c::cmd_clone(): use_local_hardlinks, use_separate_remote builtin-fetch-pack.c::find_common(): len builtin-remote.c::mv(): symref diff.c::show_stats():show_stats(): total diffcore-break.c::should_break(): base_size fast-import.c::validate_raw_date(): date, sign fsck.c::fsck_tree(): o_sha1, sha1 xdiff-interface.c::parse_num(): read_some Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 36adb4a commit eb3a9dd

File tree

8 files changed

+9
-27
lines changed

8 files changed

+9
-27
lines changed

builtin-clone.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,6 @@ static void install_branch_config(const char *local,
365365

366366
int cmd_clone(int argc, const char **argv, const char *prefix)
367367
{
368-
int use_local_hardlinks = 1;
369-
int use_separate_remote = 1;
370368
int is_bundle = 0;
371369
struct stat buf;
372370
const char *repo_name, *repo, *work_tree, *git_dir;
@@ -388,9 +386,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
388386
if (argc == 0)
389387
die("You must specify a repository to clone.");
390388

391-
if (option_no_hardlinks)
392-
use_local_hardlinks = 0;
393-
394389
if (option_mirror)
395390
option_bare = 1;
396391

@@ -399,7 +394,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
399394
die("--bare and --origin %s options are incompatible.",
400395
option_origin);
401396
option_no_checkout = 1;
402-
use_separate_remote = 0;
403397
}
404398

405399
if (!option_origin)

builtin-fetch-pack.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,8 @@ static int find_common(int fd[2], unsigned char *result_sha1,
216216
if (args.depth > 0) {
217217
char line[1024];
218218
unsigned char sha1[20];
219-
int len;
220219

221-
while ((len = packet_read_line(fd[0], line, sizeof(line)))) {
220+
while (packet_read_line(fd[0], line, sizeof(line))) {
222221
if (!prefixcmp(line, "shallow ")) {
223222
if (get_sha1_hex(line + 8, sha1))
224223
die("invalid shallow line: %s", line);

builtin-remote.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,8 @@ static int mv(int argc, const char **argv)
484484
struct string_list_item *item = remote_branches.items + i;
485485
int flag = 0;
486486
unsigned char sha1[20];
487-
const char *symref;
488487

489-
symref = resolve_ref(item->string, sha1, 1, &flag);
488+
resolve_ref(item->string, sha1, 1, &flag);
490489
if (!(flag & REF_ISSYMREF))
491490
continue;
492491
if (delete_ref(item->string, NULL, REF_NODEREF))

diff.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ static void fill_print_name(struct diffstat_file *file)
875875

876876
static void show_stats(struct diffstat_t* data, struct diff_options *options)
877877
{
878-
int i, len, add, del, total, adds = 0, dels = 0;
878+
int i, len, add, del, adds = 0, dels = 0;
879879
int max_change = 0, max_len = 0;
880880
int total_files = data->nr;
881881
int width, name_width;
@@ -978,14 +978,12 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
978978
*/
979979
add = added;
980980
del = deleted;
981-
total = add + del;
982981
adds += add;
983982
dels += del;
984983

985984
if (width <= max_change) {
986985
add = scale_linear(add, width, max_change);
987986
del = scale_linear(del, width, max_change);
988-
total = add + del;
989987
}
990988
show_name(options->file, prefix, name, len, reset, set);
991989
fprintf(options->file, "%5d%s", added + deleted,

diffcore-break.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static int should_break(struct diff_filespec *src,
4545
* The value we return is 1 if we want the pair to be broken,
4646
* or 0 if we do not.
4747
*/
48-
unsigned long delta_size, base_size, max_size;
48+
unsigned long delta_size, max_size;
4949
unsigned long src_copied, literal_added, src_removed;
5050

5151
*merge_score_p = 0; /* assume no deletion --- "do not break"
@@ -64,7 +64,6 @@ static int should_break(struct diff_filespec *src,
6464
if (diff_populate_filespec(src, 0) || diff_populate_filespec(dst, 0))
6565
return 0; /* error but caught downstream */
6666

67-
base_size = ((src->size < dst->size) ? src->size : dst->size);
6867
max_size = ((src->size > dst->size) ? src->size : dst->size);
6968
if (max_size < MINIMUM_BREAK_SIZE)
7069
return 0; /* we do not break too small filepair */

fast-import.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,21 +1745,19 @@ static void parse_data(struct strbuf *sb)
17451745
static int validate_raw_date(const char *src, char *result, int maxlen)
17461746
{
17471747
const char *orig_src = src;
1748-
char *endp, sign;
1749-
unsigned long date;
1748+
char *endp;
17501749

17511750
errno = 0;
17521751

1753-
date = strtoul(src, &endp, 10);
1752+
strtoul(src, &endp, 10);
17541753
if (errno || endp == src || *endp != ' ')
17551754
return -1;
17561755

17571756
src = endp + 1;
17581757
if (*src != '-' && *src != '+')
17591758
return -1;
1760-
sign = *src;
17611759

1762-
date = strtoul(src + 1, &endp, 10);
1760+
strtoul(src + 1, &endp, 10);
17631761
if (errno || endp == src || *endp || (endp - orig_src) >= maxlen)
17641762
return -1;
17651763

fsck.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,17 @@ static int fsck_tree(struct tree *item, int strict, fsck_error error_func)
148148
struct tree_desc desc;
149149
unsigned o_mode;
150150
const char *o_name;
151-
const unsigned char *o_sha1;
152151

153152
init_tree_desc(&desc, item->buffer, item->size);
154153

155154
o_mode = 0;
156155
o_name = NULL;
157-
o_sha1 = NULL;
158156

159157
while (desc.size) {
160158
unsigned mode;
161159
const char *name;
162-
const unsigned char *sha1;
163160

164-
sha1 = tree_entry_extract(&desc, &name, &mode);
161+
tree_entry_extract(&desc, &name, &mode);
165162

166163
if (strchr(name, '/'))
167164
has_full_path = 1;
@@ -207,7 +204,6 @@ static int fsck_tree(struct tree *item, int strict, fsck_error error_func)
207204

208205
o_mode = mode;
209206
o_name = name;
210-
o_sha1 = sha1;
211207
}
212208

213209
retval = 0;

xdiff-interface.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ static int parse_num(char **cp_p, int *num_p)
1515
{
1616
char *cp = *cp_p;
1717
int num = 0;
18-
int read_some;
1918

2019
while ('0' <= *cp && *cp <= '9')
2120
num = num * 10 + *cp++ - '0';
22-
if (!(read_some = cp - *cp_p))
21+
if (!(cp - *cp_p))
2322
return -1;
2423
*cp_p = cp;
2524
*num_p = num;

0 commit comments

Comments
 (0)