Remove unnecessary duplicate_count in fast-import.
There is little reason to be keeping a global duplicate_count value when we also keep it per object type. The global counter can easily be computed at the end, once all processing has completed. This saves us a couple of machine instructions in an unimportant part of code. But it looks slightly better to me to not keep two counters around. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Jan 15, 2007 at 05:03 UTC
80144727acc401070039434987692276dcb9273c
1 file changed
+4
-3
fast-import.c
+4
-3
@@ -217,7 +217,6 @@ static unsigned long alloc_count;
217
static unsigned long branch_count;
218
static unsigned long branch_load_count;
219
static unsigned long object_count;
220
-static unsigned long duplicate_count;
220
static unsigned long marks_set_count;
221
static unsigned long object_count_by_type[1 << TYPE_BITS];
222
static unsigned long duplicate_count_by_type[1 << TYPE_BITS];
@@ -765,7 +764,6 @@ static int store_object(
764
if (mark)
765
insert_mark(mark, e);
766
if (e->offset) {
768
- duplicate_count++;
767
duplicate_count_by_type[type]++;
768
return 1;
769
}
@@ -1722,7 +1720,7 @@ int main(int argc, const char **argv)
1720
{
1721
int i;
1722
unsigned long est_obj_cnt = object_entry_alloc;
1725
- struct stat sb;
1723
+ unsigned long duplicate_count;
1724
1725
setup_ident();
1726
git_config(git_default_config);
@@ -1784,6 +1782,9 @@ int main(int argc, const char **argv)
1782
if (branch_log)
1783
fclose(branch_log);
1784
1785
+ for (i = 0; i < ARRAY_SIZE(duplicate_count_by_type); i++)
1786
+ duplicate_count += duplicate_count_by_type[i];
1787
+
1788
fprintf(stderr, "%s statistics:\n", argv[0]);
1789
fprintf(stderr, "---------------------------------------------------------------------\n");
1790
fprintf(stderr, "Alloc'd objects: %10lu (%10lu overflow )\n", alloc_count, alloc_count - est_obj_cnt);