1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-22 01:36:09 +02:00

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>
This commit is contained in:
Benjamin Kramer 2009-03-07 21:02:10 +01:00 committed by Junio C Hamano
parent 36adb4abbd
commit eb3a9dd327
8 changed files with 9 additions and 27 deletions

View File

@ -365,8 +365,6 @@ static void install_branch_config(const char *local,
int cmd_clone(int argc, const char **argv, const char *prefix)
{
int use_local_hardlinks = 1;
int use_separate_remote = 1;
int is_bundle = 0;
struct stat buf;
const char *repo_name, *repo, *work_tree, *git_dir;
@ -388,9 +386,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (argc == 0)
die("You must specify a repository to clone.");
if (option_no_hardlinks)
use_local_hardlinks = 0;
if (option_mirror)
option_bare = 1;
@ -399,7 +394,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
die("--bare and --origin %s options are incompatible.",
option_origin);
option_no_checkout = 1;
use_separate_remote = 0;
}
if (!option_origin)

View File

@ -216,9 +216,8 @@ static int find_common(int fd[2], unsigned char *result_sha1,
if (args.depth > 0) {
char line[1024];
unsigned char sha1[20];
int len;
while ((len = packet_read_line(fd[0], line, sizeof(line)))) {
while (packet_read_line(fd[0], line, sizeof(line))) {
if (!prefixcmp(line, "shallow ")) {
if (get_sha1_hex(line + 8, sha1))
die("invalid shallow line: %s", line);

View File

@ -484,9 +484,8 @@ static int mv(int argc, const char **argv)
struct string_list_item *item = remote_branches.items + i;
int flag = 0;
unsigned char sha1[20];
const char *symref;
symref = resolve_ref(item->string, sha1, 1, &flag);
resolve_ref(item->string, sha1, 1, &flag);
if (!(flag & REF_ISSYMREF))
continue;
if (delete_ref(item->string, NULL, REF_NODEREF))

4
diff.c
View File

@ -875,7 +875,7 @@ static void fill_print_name(struct diffstat_file *file)
static void show_stats(struct diffstat_t* data, struct diff_options *options)
{
int i, len, add, del, total, adds = 0, dels = 0;
int i, len, add, del, adds = 0, dels = 0;
int max_change = 0, max_len = 0;
int total_files = data->nr;
int width, name_width;
@ -978,14 +978,12 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
*/
add = added;
del = deleted;
total = add + del;
adds += add;
dels += del;
if (width <= max_change) {
add = scale_linear(add, width, max_change);
del = scale_linear(del, width, max_change);
total = add + del;
}
show_name(options->file, prefix, name, len, reset, set);
fprintf(options->file, "%5d%s", added + deleted,

View File

@ -45,7 +45,7 @@ static int should_break(struct diff_filespec *src,
* The value we return is 1 if we want the pair to be broken,
* or 0 if we do not.
*/
unsigned long delta_size, base_size, max_size;
unsigned long delta_size, max_size;
unsigned long src_copied, literal_added, src_removed;
*merge_score_p = 0; /* assume no deletion --- "do not break"
@ -64,7 +64,6 @@ static int should_break(struct diff_filespec *src,
if (diff_populate_filespec(src, 0) || diff_populate_filespec(dst, 0))
return 0; /* error but caught downstream */
base_size = ((src->size < dst->size) ? src->size : dst->size);
max_size = ((src->size > dst->size) ? src->size : dst->size);
if (max_size < MINIMUM_BREAK_SIZE)
return 0; /* we do not break too small filepair */

View File

@ -1745,21 +1745,19 @@ static void parse_data(struct strbuf *sb)
static int validate_raw_date(const char *src, char *result, int maxlen)
{
const char *orig_src = src;
char *endp, sign;
unsigned long date;
char *endp;
errno = 0;
date = strtoul(src, &endp, 10);
strtoul(src, &endp, 10);
if (errno || endp == src || *endp != ' ')
return -1;
src = endp + 1;
if (*src != '-' && *src != '+')
return -1;
sign = *src;
date = strtoul(src + 1, &endp, 10);
strtoul(src + 1, &endp, 10);
if (errno || endp == src || *endp || (endp - orig_src) >= maxlen)
return -1;

6
fsck.c
View File

@ -148,20 +148,17 @@ static int fsck_tree(struct tree *item, int strict, fsck_error error_func)
struct tree_desc desc;
unsigned o_mode;
const char *o_name;
const unsigned char *o_sha1;
init_tree_desc(&desc, item->buffer, item->size);
o_mode = 0;
o_name = NULL;
o_sha1 = NULL;
while (desc.size) {
unsigned mode;
const char *name;
const unsigned char *sha1;
sha1 = tree_entry_extract(&desc, &name, &mode);
tree_entry_extract(&desc, &name, &mode);
if (strchr(name, '/'))
has_full_path = 1;
@ -207,7 +204,6 @@ static int fsck_tree(struct tree *item, int strict, fsck_error error_func)
o_mode = mode;
o_name = name;
o_sha1 = sha1;
}
retval = 0;

View File

@ -15,11 +15,10 @@ static int parse_num(char **cp_p, int *num_p)
{
char *cp = *cp_p;
int num = 0;
int read_some;
while ('0' <= *cp && *cp <= '9')
num = num * 10 + *cp++ - '0';
if (!(read_some = cp - *cp_p))
if (!(cp - *cp_p))
return -1;
*cp_p = cp;
*num_p = num;