Index: src/factory.cc |
=================================================================== |
--- src/factory.cc (revision 2423) |
+++ src/factory.cc (working copy) |
@@ -570,13 +570,9 @@ |
int descriptor_count = 0; |
// Copy the descriptors from the array. |
- { |
- DescriptorWriter w(*result); |
- for (DescriptorReader r(*array); !r.eos(); r.advance()) { |
- if (!r.IsNullDescriptor()) { |
- w.WriteFrom(&r); |
- } |
- descriptor_count++; |
+ for (int i = 0; i < array->number_of_descriptors(); i++) { |
+ if (array->GetType(i) != NULL_DESCRIPTOR) { |
+ result->SetFrom(descriptor_count++, *array, i); |
iposva
2009/07/10 16:36:15
This would probably be more readable if SetFrom wa
Mads Ager (chromium)
2009/07/10 19:21:08
I agree. Thanks.
|
} |
} |
@@ -609,13 +605,11 @@ |
// If duplicates were detected, allocate a result of the right size |
// and transfer the elements. |
if (duplicates > 0) { |
+ int number_of_descriptors = result->number_of_descriptors() - duplicates; |
Handle<DescriptorArray> new_result = |
- NewDescriptorArray(result->number_of_descriptors() - duplicates); |
- DescriptorWriter w(*new_result); |
- DescriptorReader r(*result); |
- while (!w.eos()) { |
- w.WriteFrom(&r); |
- r.advance(); |
+ NewDescriptorArray(number_of_descriptors); |
+ for (int i = 0; i < number_of_descriptors; i++) { |
+ new_result->SetFrom(i, *result, i); |
} |
result = new_result; |
} |