@matheusbsbs / matheus-bagliano / commits / eb3a9dd327
Fork 0

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>

Benjamin Kramer committed Mar 7, 2009 at 21:02 UTC eb3a9dd3279fe4b05f286665986ebf6d43a6ccc0
8 files changed +9 -27
builtin-clone.c
-6
@@ -365,8 +365,6 @@ static void install_branch_config(const char *local,
365
366 int cmd_clone(int argc, const char **argv, const char *prefix)
367 {
368 - int use_local_hardlinks = 1;
369 - int use_separate_remote = 1;
368 int is_bundle = 0;
369 struct stat buf;
370 const char *repo_name, *repo, *work_tree, *git_dir;
@@ -388,9 +386,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
386 if (argc == 0)
387 die("You must specify a repository to clone.");
388
391 - if (option_no_hardlinks)
392 - use_local_hardlinks = 0;
393 -
389 if (option_mirror)
390 option_bare = 1;
391
@@ -399,7 +394,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
394 die("--bare and --origin %s options are incompatible.",
395 option_origin);
396 option_no_checkout = 1;
402 - use_separate_remote = 0;
397 }
398
399 if (!option_origin)
builtin-fetch-pack.c
+1 -2
@@ -216,9 +216,8 @@ static int find_common(int fd[2], unsigned char *result_sha1,
216 if (args.depth > 0) {
217 char line[1024];
218 unsigned char sha1[20];
219 - int len;
219
221 - while ((len = packet_read_line(fd[0], line, sizeof(line)))) {
220 + while (packet_read_line(fd[0], line, sizeof(line))) {
221 if (!prefixcmp(line, "shallow ")) {
222 if (get_sha1_hex(line + 8, sha1))
223 die("invalid shallow line: %s", line);
builtin-remote.c
+1 -2
@@ -484,9 +484,8 @@ static int mv(int argc, const char **argv)
484 struct string_list_item *item = remote_branches.items + i;
485 int flag = 0;
486 unsigned char sha1[20];
487 - const char *symref;
487
489 - symref = resolve_ref(item->string, sha1, 1, &flag);
488 + resolve_ref(item->string, sha1, 1, &flag);
489 if (!(flag & REF_ISSYMREF))
490 continue;
491 if (delete_ref(item->string, NULL, REF_NODEREF))
diff.c
+1 -3
@@ -875,7 +875,7 @@ static void fill_print_name(struct diffstat_file *file)
875
876 static void show_stats(struct diffstat_t* data, struct diff_options *options)
877 {
878 - int i, len, add, del, total, adds = 0, dels = 0;
878 + int i, len, add, del, adds = 0, dels = 0;
879 int max_change = 0, max_len = 0;
880 int total_files = data->nr;
881 int width, name_width;
@@ -978,14 +978,12 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
978 */
979 add = added;
980 del = deleted;
981 - total = add + del;
981 adds += add;
982 dels += del;
983
984 if (width <= max_change) {
985 add = scale_linear(add, width, max_change);
986 del = scale_linear(del, width, max_change);
988 - total = add + del;
987 }
988 show_name(options->file, prefix, name, len, reset, set);
989 fprintf(options->file, "%5d%s", added + deleted,
diffcore-break.c
+1 -2
@@ -45,7 +45,7 @@ static int should_break(struct diff_filespec *src,
45 * The value we return is 1 if we want the pair to be broken,
46 * or 0 if we do not.
47 */
48 - unsigned long delta_size, base_size, max_size;
48 + unsigned long delta_size, max_size;
49 unsigned long src_copied, literal_added, src_removed;
50
51 *merge_score_p = 0; /* assume no deletion --- "do not break"
@@ -64,7 +64,6 @@ static int should_break(struct diff_filespec *src,
64 if (diff_populate_filespec(src, 0) || diff_populate_filespec(dst, 0))
65 return 0; /* error but caught downstream */
66
67 - base_size = ((src->size < dst->size) ? src->size : dst->size);
67 max_size = ((src->size > dst->size) ? src->size : dst->size);
68 if (max_size < MINIMUM_BREAK_SIZE)
69 return 0; /* we do not break too small filepair */
fast-import.c
+3 -5
@@ -1745,21 +1745,19 @@ static void parse_data(struct strbuf *sb)
1745 static int validate_raw_date(const char *src, char *result, int maxlen)
1746 {
1747 const char *orig_src = src;
1748 - char *endp, sign;
1749 - unsigned long date;
1748 + char *endp;
1749
1750 errno = 0;
1751
1753 - date = strtoul(src, &endp, 10);
1752 + strtoul(src, &endp, 10);
1753 if (errno || endp == src || *endp != ' ')
1754 return -1;
1755
1756 src = endp + 1;
1757 if (*src != '-' && *src != '+')
1758 return -1;
1760 - sign = *src;
1759
1762 - date = strtoul(src + 1, &endp, 10);
1760 + strtoul(src + 1, &endp, 10);
1761 if (errno || endp == src || *endp || (endp - orig_src) >= maxlen)
1762 return -1;
1763
fsck.c
+1 -5
@@ -148,20 +148,17 @@ static int fsck_tree(struct tree *item, int strict, fsck_error error_func)
148 struct tree_desc desc;
149 unsigned o_mode;
150 const char *o_name;
151 - const unsigned char *o_sha1;
151
152 init_tree_desc(&desc, item->buffer, item->size);
153
154 o_mode = 0;
155 o_name = NULL;
157 - o_sha1 = NULL;
156
157 while (desc.size) {
158 unsigned mode;
159 const char *name;
162 - const unsigned char *sha1;
160
164 - sha1 = tree_entry_extract(&desc, &name, &mode);
161 + tree_entry_extract(&desc, &name, &mode);
162
163 if (strchr(name, '/'))
164 has_full_path = 1;
@@ -207,7 +204,6 @@ static int fsck_tree(struct tree *item, int strict, fsck_error error_func)
204
205 o_mode = mode;
206 o_name = name;
210 - o_sha1 = sha1;
207 }
208
209 retval = 0;
xdiff-interface.c
+1 -2
@@ -15,11 +15,10 @@ static int parse_num(char **cp_p, int *num_p)
15 {
16 char *cp = *cp_p;
17 int num = 0;
18 - int read_some;
18
19 while ('0' <= *cp && *cp <= '9')
20 num = num * 10 + *cp++ - '0';
22 - if (!(read_some = cp - *cp_p))
21 + if (!(cp - *cp_p))
22 return -1;
23 *cp_p = cp;
24 *num_p = num;